Beispiel #1
0
 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
 {
     RefreshGrid();
     if (e.Argument == "new")
     {
         RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1;
         RadGrid1.Rebind();
     }
     if (e.Argument == "yes")
     {
         if (Session["DeleteId"] != null)
         {
             try
             {
                 LabTestId = (int)Session["DeleteId"];
                 AriCliModel.LabTest ser = (from s in ctx.LabTests
                                            where s.LabTestId == LabTestId
                                            select s).FirstOrDefault <AriCliModel.LabTest>();
                 ctx.Delete(ser);
                 ctx.SaveChanges();
                 RefreshGrid();
                 Session["DeleteId"] = null;
             }
             catch (Exception ex)
             {
                 Session["Exception"] = ex;
                 string command = String.Format("showDialog('Error','{0}','error',null, 0, 0)"
                                                , Resources.GeneralResource.DeleteRecordFail);
                 RadAjaxManager1.ResponseScripts.Add(command);
             }
         }
     }
 }
 protected bool CreateChange()
 {
     if (!DataOk())
         return false;
     if (labTestAssigned == null)
     {
         labTestAssigned = new LabTestAssigned();
         UnloadData(labTestAssigned);
         ctx.Add(labTestAssigned);
     }
     else
     {
         labTest = CntAriCli.GetLabTest(labTestId, ctx);
         UnloadData(labTestAssigned);
     }
     ctx.SaveChanges();
     return true;
 }
 protected bool DataOk()
 {
     string command = "";
     if (rdpLabTestDate.SelectedDate == null)
     {
         command = String.Format("showDialog('{0}','{1}','warning',null,0,0)"
                                 , Resources.GeneralResource.Warning
                                 , Resources.GeneralResource.DateNeeded);
         RadAjaxManager1.ResponseScripts.Add(command);
         return false;
     }
     if (rdcLabTest.SelectedValue == "")
     {
         command = String.Format("showDialog('{0}','{1}','warning',null,0,0)"
                                 , Resources.GeneralResource.Warning
                                 , Resources.GeneralResource.LabTestNeeded);
         RadAjaxManager1.ResponseScripts.Add(command);
         return false;
     }
     if (rdcPatient.SelectedValue == "")
     {
         command = String.Format("showDialog('{0}','{1}','warning',null,0,0)"
                                 , Resources.GeneralResource.Warning
                                 , Resources.GeneralResource.PatientNeeded);
         RadAjaxManager1.ResponseScripts.Add(command);
         return false;
     }
     if (txtValue.Text == "")
     {
         command = String.Format("showDialog('{0}','{1}','warning',null,0,0)"
                                 , Resources.GeneralResource.Warning
                                 , Resources.GeneralResource.ValueNeeded);
         RadAjaxManager1.ResponseScripts.Add(command);
         return false;
     }
     // 
     labTest = CntAriCli.GetLabTest(int.Parse(rdcLabTest.SelectedValue), ctx);
     if (labTest.GeneralType == "LBTN")
     {
         decimal v;
         if (!Decimal.TryParse(txtValue.Text, out v))
         {
             command = String.Format("showDialog('{0}','{1}','warning',null,0,0)"
                     , Resources.GeneralResource.Warning
                     , Resources.GeneralResource.NumericNeeded);
             RadAjaxManager1.ResponseScripts.Add(command);
             return false;
         }
     }
     return true;
 }