Ejemplo n.º 1
0
 private void SetValuesSub(String sm_Category)
 {
     try
     {
         M_CustomerSub objm_Category = new M_CustomerSub();
         if (sm_Category != "")
         {
             objm_Category.CussubID = sm_Category;
             objm_Category          = new M_CustomerSubDL().Selectm_CustomerSub(objm_Category);
             if (objm_Category != null)
             {
                 txt_subcatcode.Text = objm_Category.CussubID.ToString();
                 txt_subcatname.Text = objm_Category.Description.ToString();
                 chk_locksub.Checked = false;
                 formMode            = 0;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 2
0
        private void btn_addSub_Click(object sender, EventArgs e)
        {
            if (txt_subcatcode.Text.Trim() == "")
            {
                errorProvider1.SetError(txt_subcatcode, "Please enter a customer subcategory code !");
                return;
            }

            if (txt_subcatname.Text.Trim() == "")
            {
                errorProvider1.SetError(txt_subcatname, "Please enter a customer subcategory !");
                return;
            }

            lbl_newsub.Hide();
            try
            {
                if (!M_CustomerSubDL.ExistingM_CustomerSub(txt_subcatcode.Text.Trim(), txt_Codex.Text))
                {
                    lbl_newsub.Show();
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_CustomerSub objm_SubCategory = new M_CustomerSub();
                        objm_SubCategory.CussubID    = txt_subcatcode.Text.Trim();
                        objm_SubCategory.CatID       = txt_Codex.Text.Trim();
                        objm_SubCategory.Description = txt_subcatname.Text.Trim();
                        objm_SubCategory.Userx       = commonFunctions.Loginuser;
                        objm_SubCategory.Datex       = DateTime.Now;
                        new M_CustomerSubDL().Savem_CustomerSubSP(objm_SubCategory, 1);

                        GetData();

                        txt_Codex.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else
                {
                    lbl_newsub.Hide();
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_CustomerSub objm_SubCategory = new M_CustomerSub();
                        objm_SubCategory.CussubID    = txt_subcatcode.Text.Trim();
                        objm_SubCategory.CatID       = txt_Codex.Text.Trim();
                        objm_SubCategory.Description = txt_subcatname.Text.Trim();
                        objm_SubCategory.Userx       = commonFunctions.Loginuser;
                        objm_SubCategory.Datex       = DateTime.Now;
                        new M_CustomerSubDL().Savem_CustomerSubSP(objm_SubCategory, 3);

                        GetData();

                        txt_Codex.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);

                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    }
                }
            }
            catch (Exception ex)
            {
                LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                commonFunctions.SetMDIStatusMessage("Genaral Error on loading data", 1);
            }
        }