コード例 #1
0
ファイル: ClsTreatment.cs プロジェクト: xiaoliukai/VMukti
        public static ClsTreatment GetByTreatmentID(int ID)
        {
            ClsTreatment obj = new ClsTreatment();
            DataSet      ds  = new Treatment.DataAccess.ClsTreatmentDataService().Treatment_GetByID(ID);

            if (!obj.MapData(ds))
            {
                obj = null;
            }
            return(obj);
        }
コード例 #2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // We First Have to delete all treatmentconditions related to treatment from DB. 
                CtlGrid.IsEnabled = true;
                ClsTreatment objTreatment = new ClsTreatment();
                if (VarState == 0)
                    objTreatment.ID = -1;
                else
                {
                    if (rdDisposition.IsChecked == true)
                    {
                        ClsTreatment.Delete_Disposition(varID);
                        objTreatment.ID = varID;
                    }
                    else
                    {
                        ClsTreatment.Delete_All(varID);
                        objTreatment.ID = varID;
                    }
                }
                if (txtName.Text != "" && lstConditionsCreated.Items.Count>0)
                {
                    objTreatment.TreatmentName = txtName.Text;
                    objTreatment.Description = txtDescription.Text;
                    objTreatment.IsInclude = true;
                    objTreatment.Type = strTreatmentType;
                    objTreatment.UserID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                    int gID = objTreatment.Save();

                    for (int i = 0; i < lstConditionsCreated.Items.Count; i++)
                    {
                        ClsTreatmentCondition c = new ClsTreatmentCondition();
                        string[] str = ((ListBoxItem)lstConditionsCreated.Items[i]).Tag.ToString().Split('~');
                        if (str[0] != "Call After")
                        {
                        string[] strLeadFormatID = (cmbLeadFormat.SelectedItem.ToString().Split(':'));
                        c.LeadFormatName=strLeadFormatID[1].ToString().TrimStart();
                            if (strTreatmentType == "Filter")
                            {
                                str[2] = str[2].Replace(",", "~");
                                if(str[2].Substring(str[2].Length-1).Contains("~"))
                                {
                                    //str[2] = str[2].Substring(str[2].Length - 1).Replace("", "~");
                                    str[2] = str[2].Substring(0, str[2].Length - 1);
                                }
                            }
                        c.FieldName = str[0];
                        c.Operator = str[1];
                        c.FieldValues = str[2];
                        c.ID = -1;
                        c.TreatmentID = gID;                        
                        c.Save();
                    }
                        else
                        {
                            c.Duration = str[1];
                            c.TreatmentID = gID;
                            c.Disposition = str[2];
                            c.SaveDisposition();
                        }
                    }
                    System.Windows.MessageBox.Show("Record Saved Successfully!!");
                    rdDisposition.IsEnabled = true;
                    rdFieldValue.IsEnabled = true;
                    rdFilter.IsChecked = false;
                    fncSetGrid();
                    fncSetComboboxes();
                    funClearBoxes();
                    btnEdit.IsEnabled = true;
                    btnAdd.IsEnabled = true;
                    rdFilter.IsEnabled = true;
                }
                else
                {
                    System.Windows.MessageBox.Show("Treatment Name and Treatment conditions can't be null");
                }
            }
            catch(Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "btnSave_Click()", "CtlTratment.xaml.cs");

            }  
        }
コード例 #3
0
 public static ClsTreatment GetByTreatmentID(int ID)
 {
     ClsTreatment obj = new ClsTreatment();
     DataSet ds = new Treatment.DataAccess.ClsTreatmentDataService().Treatment_GetByID(ID);
     if (!obj.MapData(ds)) obj = null;
     return obj;
 }