public static ClsTreatmentCondition GetByTreatmentID(int ID)
        {
            ClsTreatmentCondition obj = new ClsTreatmentCondition();
            DataSet ds = new Treatment.DataAccess.ClsTreatmentConditionDataService().TreatmentCondition_GetByTreatmentID(ID);

            if (!obj.MapData(ds))
            {
                obj = null;
            }
            return(obj);
        }
        private void CtlGrid_btnEditClicked(int rowID)
        {
            try
            {
                CtlGrid.IsEnabled = false;
                
                VarState = 1;
                varID = Convert.ToInt32(objTreatmentCollection[rowID].ID);
                txtName.Text = objTreatmentCollection[rowID].TreatmentName.ToString();
                txtDescription.Text = objTreatmentCollection[rowID].Description.ToString();
                strTreatmentType = objTreatmentCollection[rowID].Type.ToString();
                cmbValues.Items.Clear();
                objTreatmentConditionCollection = ClsTreatmentConditionCollection.GetAll(varID);
                DataTable dt = ObjectArrayToDataTable1(ClsTreatmentConditionCollection.GetAll(varID), typeof(ClsTreatmentCondition));
                if (dt.Rows.Count != 0)
                {
                    if (strTreatmentType == "Filter")
                    {
                        rdFilter.IsChecked = true;
                        rdFilter.IsEnabled = false;
                        rdDisposition.IsEnabled = false;
                        rdFieldValue.IsEnabled = false;
                    }
                    else
                    {
                    rdFieldValue.IsChecked = true;
                    rdFieldValue.IsEnabled = false;
                    rdDisposition.IsEnabled = false;
                        rdFilter.IsEnabled = false;
                    }
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cmbLeadFormat.Text = objTreatmentConditionCollection[i].LeadFormatName.ToString();
                    string str = "(" + objTreatmentConditionCollection[i].FieldName.ToString() + " " + objTreatmentConditionCollection[i].Operator.ToString() + " " + objTreatmentConditionCollection[i].FieldValues.ToString() + " )";
                    ListBoxItem newItem = new ListBoxItem();
                    newItem.Content = str;
                    if (strTreatmentType == "Filter")
                    {
                        newItem.Tag = objTreatmentConditionCollection[i].FieldName.ToString() + "~" + objTreatmentConditionCollection[i].Operator.ToString() + "~" + objTreatmentConditionCollection[i].FieldValues.ToString().Replace("~",",");
                    }
                    else
                    {
                    newItem.Tag = objTreatmentConditionCollection[i].FieldName.ToString() + "~" + objTreatmentConditionCollection[i].Operator.ToString() + "~" + objTreatmentConditionCollection[i].FieldValues.ToString();
                    }
                    lstConditionsCreated.Items.Add(newItem);
                }
                Treatment.DataAccess.ClsTreatmentConditionDataService obj = new Treatment.DataAccess.ClsTreatmentConditionDataService();
                DataSet ds = obj.TreatmentDisposition_GetByTreatmentID(varID);
                DataTable dt1 = ds.Tables[0];
                if (dt1.Rows.Count != 0)
                {
                    rdDisposition.IsChecked = true;
                    rdDisposition.IsEnabled = false;
                    rdFieldValue.IsEnabled = false;
                }
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    //cmbLeadFormat.Text = objTreatmentConditionCollection[i].LeadFormatName.ToString();
                    string str = "(Call After" + " " + dt1.Rows[i]["Duration"] + " on " + dt1.Rows[i]["Disposition"] + " )";
                    ListBoxItem newItem = new ListBoxItem();
                    newItem.Content = str;
                    newItem.Tag = "Call After ~" + dt1.Rows[i]["Duration"] + "~" + dt1.Rows[i]["Disposition"];
                    lstConditionsCreated.Items.Add(newItem);
                }
                //if (strTreatmentType == "Filter")
                //{
                //    if (lstConditionsCreated.Items.Count > 0)
                //    {
                //        btnAdd.IsEnabled = false;
                //    }
                //}

            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "CtlGrid_btnEditClicked()", "CtlTratment.xaml.cs");

            }
        }
 public static ClsTreatmentCondition GetByTreatmentID(int ID)
 {
     ClsTreatmentCondition obj = new ClsTreatmentCondition();
     DataSet ds = new Treatment.DataAccess.ClsTreatmentConditionDataService().TreatmentCondition_GetByTreatmentID(ID);
     if (!obj.MapData(ds)) obj = null;
     return obj;
 }
Example #4
0
        private void CtlGrid_btnEditClicked(int rowID)
        {
            try
            {
                CtlGrid.IsEnabled = false;

                VarState            = 1;
                varID               = Convert.ToInt32(objTreatmentCollection[rowID].ID);
                txtName.Text        = objTreatmentCollection[rowID].TreatmentName.ToString();
                txtDescription.Text = objTreatmentCollection[rowID].Description.ToString();
                strTreatmentType    = objTreatmentCollection[rowID].Type.ToString();
                cmbValues.Items.Clear();
                objTreatmentConditionCollection = ClsTreatmentConditionCollection.GetAll(varID);
                DataTable dt = ObjectArrayToDataTable1(ClsTreatmentConditionCollection.GetAll(varID), typeof(ClsTreatmentCondition));
                if (dt.Rows.Count != 0)
                {
                    if (strTreatmentType == "Filter")
                    {
                        rdFilter.IsChecked      = true;
                        rdFilter.IsEnabled      = false;
                        rdDisposition.IsEnabled = false;
                        rdFieldValue.IsEnabled  = false;
                    }
                    else
                    {
                        rdFieldValue.IsChecked  = true;
                        rdFieldValue.IsEnabled  = false;
                        rdDisposition.IsEnabled = false;
                        rdFilter.IsEnabled      = false;
                    }
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cmbLeadFormat.Text = objTreatmentConditionCollection[i].LeadFormatName.ToString();
                    string      str     = "(" + objTreatmentConditionCollection[i].FieldName.ToString() + " " + objTreatmentConditionCollection[i].Operator.ToString() + " " + objTreatmentConditionCollection[i].FieldValues.ToString() + " )";
                    ListBoxItem newItem = new ListBoxItem();
                    newItem.Content = str;
                    if (strTreatmentType == "Filter")
                    {
                        newItem.Tag = objTreatmentConditionCollection[i].FieldName.ToString() + "~" + objTreatmentConditionCollection[i].Operator.ToString() + "~" + objTreatmentConditionCollection[i].FieldValues.ToString().Replace("~", ",");
                    }
                    else
                    {
                        newItem.Tag = objTreatmentConditionCollection[i].FieldName.ToString() + "~" + objTreatmentConditionCollection[i].Operator.ToString() + "~" + objTreatmentConditionCollection[i].FieldValues.ToString();
                    }
                    lstConditionsCreated.Items.Add(newItem);
                }
                Treatment.DataAccess.ClsTreatmentConditionDataService obj = new Treatment.DataAccess.ClsTreatmentConditionDataService();
                DataSet   ds  = obj.TreatmentDisposition_GetByTreatmentID(varID);
                DataTable dt1 = ds.Tables[0];
                if (dt1.Rows.Count != 0)
                {
                    rdDisposition.IsChecked = true;
                    rdDisposition.IsEnabled = false;
                    rdFieldValue.IsEnabled  = false;
                }
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    //cmbLeadFormat.Text = objTreatmentConditionCollection[i].LeadFormatName.ToString();
                    string      str     = "(Call After" + " " + dt1.Rows[i]["Duration"] + " on " + dt1.Rows[i]["Disposition"] + " )";
                    ListBoxItem newItem = new ListBoxItem();
                    newItem.Content = str;
                    newItem.Tag     = "Call After ~" + dt1.Rows[i]["Duration"] + "~" + dt1.Rows[i]["Disposition"];
                    lstConditionsCreated.Items.Add(newItem);
                }
                //if (strTreatmentType == "Filter")
                //{
                //    if (lstConditionsCreated.Items.Count > 0)
                //    {
                //        btnAdd.IsEnabled = false;
                //    }
                //}
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "CtlGrid_btnEditClicked()", "CtlTratment.xaml.cs");
            }
        }