/// <summary> /// Saves a record to the M_CustomerCategory table. /// </summary> public Boolean Savem_CustomerCategorySP(M_CustomerCategory m_CustomerCategory, int formMode) { SqlCommand scom; bool retvalue = false; try { scom = new SqlCommand(); scom.CommandType = CommandType.StoredProcedure; scom.CommandText = "M_CustomerCategorySave"; scom.Parameters.Add("@CusCateID", SqlDbType.VarChar, 20).Value = m_CustomerCategory.CusCateID; scom.Parameters.Add("@Description", SqlDbType.VarChar, 120).Value = m_CustomerCategory.Description; scom.Parameters.Add("@Userx", SqlDbType.VarChar, 20).Value = m_CustomerCategory.Userx; scom.Parameters.Add("@Datex", SqlDbType.DateTime, 8).Value = m_CustomerCategory.Datex; scom.Parameters.Add("@InsMode", SqlDbType.Int).Value = formMode; // For insert scom.Parameters.Add("@RtnValue", SqlDbType.Int).Value = 0; u_DBConnection dbcon = new u_DBConnection(); retvalue = dbcon.RunQuery(scom); return(retvalue); } catch (Exception ex) { throw (ex); } }
public List <M_CustomerCategory> SelectM_CustomerCategoryMulti(M_CustomerCategory objm_CustomerCategory2) { List <M_CustomerCategory> retval = new List <M_CustomerCategory>(); try { strquery = @"select * from m_CustomerCategory where CusCateID = '" + objm_CustomerCategory2.CusCateID + "'"; DataTable dtm_CustomerCategory = u_DBConnection.ReturnDataTable(strquery, CommandType.Text); foreach (DataRow drType in dtm_CustomerCategory.Rows) { if (drType != null) { M_CustomerCategory objm_CustomerCategory = new M_CustomerCategory(); objm_CustomerCategory.CusCateID = drType["CusCateID"].ToString(); objm_CustomerCategory.Description = drType["Description"].ToString(); objm_CustomerCategory.Userx = drType["Userx"].ToString(); objm_CustomerCategory.Datex = DateTime.Parse(drType["Datex"].ToString()); retval.Add(objm_CustomerCategory); } } return(retval); } catch (Exception ex) { throw ex; } }
public static string FindExisitingCustomerCategory(string suppcode) { string str = ""; if (M_CustomerCategoryDL.ExistingM_CustomerCategory(suppcode.Trim())) { M_CustomerCategory cat = new M_CustomerCategory(); cat.CusCateID = suppcode.Trim(); str = new M_CustomerCategoryDL().Selectm_CustomerCategory(cat).Description; } else { str = "<Error!!!>"; } return(str); }
public M_CustomerCategory Selectm_CustomerCategory(M_CustomerCategory objm_CustomerCategory) { try { strquery = @"select * from m_CustomerCategory where CusCateID = '" + objm_CustomerCategory.CusCateID + "'"; DataRow drType = u_DBConnection.ReturnDataRow(strquery); if (drType != null) { objm_CustomerCategory.CusCateID = drType["CusCateID"].ToString(); objm_CustomerCategory.Description = drType["Description"].ToString(); objm_CustomerCategory.Userx = drType["Userx"].ToString(); objm_CustomerCategory.Datex = DateTime.Parse(drType["Datex"].ToString()); return(objm_CustomerCategory); } return(null); } catch (Exception ex) { throw ex; } }
private void SetValues(String sm_Category) { try { M_CustomerCategory objm_Category = new M_CustomerCategory(); if (sm_Category != "") { objm_Category.CusCateID = sm_Category; objm_Category = new M_CustomerCategoryDL().Selectm_CustomerCategory(objm_Category); if (objm_Category != null) { txt_Codex.Text = objm_Category.CusCateID.ToString(); txt_Descr.Text = objm_Category.Description.ToString(); GetDataSUB(objm_Category.CusCateID.ToString()); formMode = 0; } } } catch (Exception ex) { } }
private void btn_addCat_Click(object sender, EventArgs e) { if (txt_Codex.Text.Trim() == "") { errorProvider1.SetError(txt_Codex, "Please enter a customer category code !"); return; } if (txt_Descr.Text.Trim() == "") { errorProvider1.SetError(txt_Descr, "Please enter a customer category !"); return; } lbl_new.Hide(); try { if (M_CustomerCategoryDL.ExistingM_CustomerCategory(txt_Codex.Text.Trim())) { lbl_new.Hide(); if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes) { M_CustomerCategory objm_Category = new M_CustomerCategory(); objm_Category.CusCateID = txt_Codex.Text.Trim(); objm_Category.Description = txt_Descr.Text.Trim(); objm_Category.Datex = DateTime.Now;//txt_date.Text.Trim(); objm_Category.Userx = commonFunctions.Loginuser; new M_CustomerCategoryDL().Savem_CustomerCategorySP(objm_Category, 3); GetData(); txt_Codex.Enabled = true; FunctionButtonStatus(xEnums.PerformanceType.Save); commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2); } } else { lbl_new.Show(); if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes) { M_CustomerCategory objm_Category = new M_CustomerCategory(); objm_Category.CusCateID = txt_Codex.Text.Trim(); objm_Category.Description = txt_Descr.Text.Trim(); objm_Category.Datex = DateTime.Now;//txt_date.Text.Trim(); objm_Category.Userx = commonFunctions.Loginuser; new M_CustomerCategoryDL().Savem_CustomerCategorySP(objm_Category, 1); 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); } }