Exemplo n.º 1
0
 public static ClsLeadDesignerBusiness GetFields()
 {
     try
     {
         ClsLeadDesignerBusiness obj = new ClsLeadDesignerBusiness();
         DataSet ds = new LeadFormatDesigner.DataAccess.ClsLeadDesignerDataService().LeadDesignerFields_Get();
         if (!obj.MapData(ds))
         {
             obj = null;
         }
         return(obj);
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "GetFields()", "ClsLeadDesignerBusiness.cs");
         return(null);
     }
 }
        public static ClsLeadDesignerBusiness GetFields()
        {
            try
            {
                ClsLeadDesignerBusiness obj = new ClsLeadDesignerBusiness();
                DataSet ds = new LeadFormatDesigner.DataAccess.ClsLeadDesignerDataService().LeadDesignerFields_Get();
                if (!obj.MapData(ds)) obj = null;
                return obj;
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "GetFields()", "ClsLeadDesignerBusiness.cs");
                return null;
            }

        }
        void btnSav_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int affectedRow;
                int flagFieldSet = 1;
                ClsLeadDesignerBusiness LeadDesigner = new ClsLeadDesignerBusiness();

                if (txtFieldName.Text.Length == 0)
                {
                    MessageBox.Show("Field Name Should not be blank");
                }
                else
                {
                    for (int cntField = 0; cntField < lstFieldNames.Items.Count; cntField++)
                    {
                        if (((ListBoxItem)lstFieldNames.Items[cntField]).Content.ToString().ToLower() == txtFieldName.Text.ToLower())
                        {
                            flagFieldSet = 0;
                            break;
                        }

                    }

                    if (flagFieldSet == 1)
                    {
                        LeadDesigner.ID = -1;
                        LeadDesigner.FieldName = txtFieldName.Text;
                        if (txtFieldSize.Text.Length == 0)
                        {
                            LeadDesigner.FieldSize = 0;
                        }
                        else
                        {
                            LeadDesigner.FieldSize = Convert.ToInt64(txtFieldSize.Text);
                        }
                        LeadDesigner.FieldType = cmbFieldType.SelectionBoxItem.ToString();
                        LeadDesigner.IsRequired = true;

                        affectedRow = LeadDesigner.Save();

                        if (affectedRow > 0)
                        {
                            MessageBox.Show("Record Added");
                            lstFieldNames.Items.Clear();
                            templst.Clear();
                            ClsLeadDesignerBusinessCollection objInsertField = ClsLeadDesignerBusinessCollection.GetAll();
                            for (int i = 0; i < objInsertField.Count; i++)
                            {
                                ListBoxItem cbiFormat = new ListBoxItem();
                                cbiFormat.Content = objInsertField[i].FieldName;
                                cbiFormat.Tag = objInsertField[i].ID;
                                lstFieldNames.Items.Add(cbiFormat);
                                templst.Add(lstFieldNames.Items[i]);
                            }
                            txtFieldName.Text = "";
                            txtFieldSize.Text = "";
                        }
                    }
                    else
                    {
                        MessageBox.Show("Duplicate Entry Found");
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "btnSav_Click()", "ctlLeadFormatDesigner.xaml.cs");
            }
        }