When i Check The CheckBox and Click the Cancel Button The Checked Data
Should Be Updated (i.e.,I Have LeaveStatus DataField In That Already Status
As Stored As "P" When i Click The Cancel Button THe Status Will Be
Updated as "C")
Table Name=LEAVEAPP;
Query=GetCancelLeaveApply;
DatGridName=dgCancellation;
ButtonName=btnCancel;
Am using this in Cancelbuttonclick event
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
int empid = Int32.Parse(WebContext.Current.User.Name);
EntityQuery<LEAVEAPP> query =
objectcontext.GetCancelLeaveApplyQuery();
LoadOperation<TMS_ESS_TTB_LEAVEAPP> loadop =
objectcontext.Load(query);
objectcontext.Load(objectcontext.GetCancelLeaveApplyQuery()).Completed
+= new EventHandler(Cancellation_Completed);
objectcontext.SubmitChanges();
}
void Cancellation_Completed(object sender, EventArgs e)
{
CheckBox chkbox =
(CheckBox)this.dgCancellation.Columns[0].GetCellContent(this.dgCancellatio
n.SelectedItem);
List<TMS_ESS_TTB_LEAVEAPP> tblist;
tblist =
((System.ServiceModel.DomainServices.Client.LoadOperation<Spider.Web.T
MS_ESS_TTB_LEAVEAPP>)(sender)).Entities.ToList();
foreach (TMS_ESS_TTB_LEAVEAPP lvapp in tblist)
{
if (lvapp.LV_EMPLOYEEID ==
Int32.Parse(WebContext.Current.User.Name))
objleaveapp = lvapp;
}
if (objleaveapp != null)
{
if ((bool)chkbox.IsChecked)
{
objleaveapp.LV_STATUS = "C ";
}
objectcontext.SubmitChanges();
MessageBox.Show("Done");
}
}
LinqQuery is
public IQueryable<TMS_ESS_TTB_LEAVEAPP> GetCancelLeaveApply()
{
var qry = from tblleaveapp in
this.ObjectContext.TMS_ESS_TTB_LEAVEAPP select tblleaveapp;
return qry;
}
Kranthi, if this helps please login to Mark As Answer. | Alert Moderator