/// <summary>
        /// Function for check settings
        /// </summary>
        public void InitialSettings()
        {

            try
            {
                SettingsSP spSettings = new SettingsSP();
                SettingsInfo info = new SettingsInfo();
                DataTable dtbl = new DataTable();
                dtbl = spSettings.SettingsViewAll();




                if (dtbl.Rows.Count > 0)
                {

                    foreach (DataRow item in dtbl.Rows)
                    {
                        info.SettingsName = item["settingsName"].ToString();
                        info.Status = item["status"].ToString();
                        if (info.SettingsName == "AllowBatch" && info.Status == "Yes")
                        {
                            cmbAllowBatch.Enabled = true;
                        }
                        if (info.SettingsName == "AllowBatch" && info.Status == "No")
                        {
                            cmbAllowBatch.Enabled = false;
                        }

                        if (info.SettingsName == "AllowSize" && info.Status == "Yes")
                        {
                            cmbSize.Enabled = true;
                            btnSizeAdd.Enabled = true;

                        }
                        if (info.SettingsName == "AllowSize" && info.Status == "No")
                        {
                            cmbSize.Enabled = false;
                            btnSizeAdd.Enabled = false;
                        }
                        if (info.SettingsName == "AllowModelNo" && info.Status == "Yes")
                        {
                            cmbModalNo.Enabled = true;
                            btnModalNo.Enabled = true;
                        }
                        if (info.SettingsName == "AllowModelNo" && info.Status == "No")
                        {
                            cmbModalNo.Enabled = false;
                            btnModalNo.Enabled = false;
                        }
                        if (info.SettingsName == "AllowGodown" && info.Status == "Yes")
                        {
                            cmbDefaultGodown.Enabled = true;
                            btnDefaultGodownAdd.Enabled = true;
                            dgvProductCreation.Columns["dgvcmbtgodown"].Visible = true;

                        }
                        if (info.SettingsName == "AllowGodown" && info.Status == "No")
                        {
                            cmbDefaultGodown.Enabled = false;
                            btnDefaultGodownAdd.Enabled = false;
                            dgvProductCreation.Columns["dgvcmbtgodown"].Visible = false;

                        }
                        if (info.SettingsName == "AllowRack" && info.Status == "Yes")
                        {
                            cmbDefaultRack.Enabled = true;
                            btnDefaultAdd.Enabled = true;

                            dgvProductCreation.Columns["dgvcmbrack"].Visible = true;


                        }
                        if (info.SettingsName == "AllowRack" && info.Status == "No")
                        {
                            cmbDefaultRack.Enabled = false;
                            btnDefaultAdd.Enabled = false;

                            dgvProductCreation.Columns["dgvcmbrack"].Visible = false;

                        }
                        if (info.SettingsName == "Tax" && info.Status == "No")
                        {
                            cmbTax.Enabled = false;
                            btnTaxAdd.Enabled = false;
                        }
                    }

                }



            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:74" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }


        }
Example #2
0
 /// <summary>
 /// Function to Fill the Settings Of Currenct Company
 /// </summary>
 public void FillSettingsOfCurrenctBranch()
 {
     SettingsSP spSettings = new SettingsSP();
     DataTable dtbl = new DataTable();
     try
     {
         dtbl = spSettings.SettingsViewAll();
         foreach (Control ctrl in this.Controls)
         {
             if (ctrl is CheckBox)
             {
                 CheckBox cb = (CheckBox)ctrl;
                 strControlls = cb.Text.Replace(" ", string.Empty);
                 foreach (DataRow dr in dtbl.Rows)
                 {
                     if (dr["settingsName"].ToString() == strControlls)
                     {
                         if (strControlls == "AllowGoDown")
                         {
                             if (dr["status"].ToString() == "Yes")
                             {
                                 cb.Checked = true;
                                 if (spSettings.SettingsStatusCheck("AllowRack") == "Yes")
                                 {
                                     cbxAllowRack.Checked = true;
                                 }
                                 else
                                 {
                                     cbxAllowRack.Checked = false;
                                 }
                             }
                             else if (dr["status"].ToString() == "No")
                             {
                                 cb.Checked = false;
                                 cbxAllowRack.Visible = false;
                                 cbxAllowRack.Checked = false;
                             }
                         }
                         else if (strControlls == "AddConfirmationFor")
                         {
                             if (dr["status"].ToString() == "Yes")
                             {
                                 cb.Checked = true;
                                 foreach (Control c in this.Controls)
                                 {
                                     if (c is CheckBox)
                                     {
                                         CheckBox cbx = (CheckBox)c;
                                         string str = cbx.Text.Replace(" ", string.Empty);
                                         if (str == "Add" || str == "Edit" || str == "Delete" || str == "Close")
                                         {
                                             foreach (DataRow dr1 in dtbl.Rows)
                                             {
                                                 if (dr1["settingsName"].ToString() == str)
                                                 {
                                                     if (dr1["status"].ToString() == "Yes")
                                                     {
                                                         cbx.Checked = true;
                                                     }
                                                     else if (dr1["status"].ToString() == "No")
                                                     {
                                                         cbx.Checked = false;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 cb.Checked = false;
                                 cbxAdd.Visible = false;
                                 cbxDelete.Visible = false;
                                 cbxEdit.Visible = false;
                                 cbxClose.Visible = false;
                             }
                         }
                         else
                         {
                             if (dr["status"].ToString() == "Yes")
                             {
                                 cb.Checked = true;
                             }
                             else if (dr["status"].ToString() == "No")
                             {
                                 cb.Checked = false;
                             }
                         }
                     }
                 }
             }
             else if (ctrl is ComboBox)
             {
                 ComboBox cmb = (ComboBox)ctrl;
                 strControlls = ctrl.Name.Replace("cmb", string.Empty);
                 foreach (DataRow dr in dtbl.Rows)
                 {
                     if (dr["settingsName"].ToString() == strControlls)
                     {
                         cmb.SelectedItem = dr["status"].ToString();
                     }
                 }
             }
         }
         Checkreference();
     }
     catch (Exception ex)
     {
         MessageBox.Show("ST6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }