private SalesArea_SalesOffice objCreateSalesArea_SalesOffice(DataRow dr) { SalesArea_SalesOffice tSalesArea_SalesOffice = new SalesArea_SalesOffice(); tSalesArea_SalesOffice.SetObjectInfo(dr); return(tSalesArea_SalesOffice); }
public SalesArea_SalesOffice objGetSalesArea_SalesOffice(string argSalesOrganizationCode, string argDistChannelCode, string argDivisionCode, string argSalesofficeCode, string argClientCode) { SalesArea_SalesOffice argSalesArea_SalesOffice = new SalesArea_SalesOffice(); DataSet DataSetToFill = new DataSet(); if (argSalesOrganizationCode.Trim() == "") { goto ErrorHandlers; } if (argDistChannelCode.Trim() == "") { goto ErrorHandlers; } if (argDivisionCode.Trim() == "") { goto ErrorHandlers; } if (argSalesofficeCode.Trim() == "") { goto ErrorHandlers; } if (argClientCode.Trim() == "") { goto ErrorHandlers; } DataSetToFill = this.GetSalesArea_SalesOffice(argSalesOrganizationCode, argDistChannelCode, argDivisionCode, argSalesofficeCode, argClientCode); if (DataSetToFill.Tables[0].Rows.Count <= 0) { goto Finish; } argSalesArea_SalesOffice = this.objCreateSalesArea_SalesOffice((DataRow)DataSetToFill.Tables[0].Rows[0]); goto Finish; ErrorHandlers: Finish: DataSetToFill = null; return(argSalesArea_SalesOffice); }
public ICollection <SalesArea_SalesOffice> colGetSalesArea_SalesOffice(DataTable dt, string argUserName, string clientCode) { List <SalesArea_SalesOffice> lst = new List <SalesArea_SalesOffice>(); SalesArea_SalesOffice objSalesArea_SalesOffice = null; foreach (DataRow dr in dt.Rows) { objSalesArea_SalesOffice = new SalesArea_SalesOffice(); objSalesArea_SalesOffice.SalesOrganizationCode = Convert.ToString(dr["SalesOrganizationCode"]).Trim(); objSalesArea_SalesOffice.DistChannelCode = Convert.ToString(dr["DistChannelCode"]).Trim(); objSalesArea_SalesOffice.DivisionCode = Convert.ToString(dr["DivisionCode"]).Trim(); objSalesArea_SalesOffice.SalesofficeCode = Convert.ToString(dr["SalesOfficeCode"]).Trim(); objSalesArea_SalesOffice.CreatedBy = Convert.ToString(argUserName); objSalesArea_SalesOffice.ModifiedBy = Convert.ToString(argUserName); objSalesArea_SalesOffice.ClientCode = Convert.ToString(clientCode).Trim(); lst.Add(objSalesArea_SalesOffice); } return(lst); }
/**********/ public void InsertSalesArea_SalesOffice(SalesArea_SalesOffice argSalesArea_SalesOffice, DataAccess da, List <ErrorHandler> lstErr) { SqlParameter[] param = new SqlParameter[10]; param[0] = new SqlParameter("@SalesOrganizationCode", argSalesArea_SalesOffice.SalesOrganizationCode); param[1] = new SqlParameter("@DistChannelCode", argSalesArea_SalesOffice.DistChannelCode); param[2] = new SqlParameter("@DivisionCode", argSalesArea_SalesOffice.DivisionCode); param[3] = new SqlParameter("@SalesofficeCode", argSalesArea_SalesOffice.SalesofficeCode); param[4] = new SqlParameter("@ClientCode", argSalesArea_SalesOffice.ClientCode); param[5] = new SqlParameter("@CreatedBy", argSalesArea_SalesOffice.CreatedBy); param[6] = new SqlParameter("@ModifiedBy", argSalesArea_SalesOffice.ModifiedBy); param[7] = new SqlParameter("@Type", SqlDbType.Char); param[7].Size = 1; param[7].Direction = ParameterDirection.Output; param[8] = new SqlParameter("@Message", SqlDbType.VarChar); param[8].Size = 255; param[8].Direction = ParameterDirection.Output; param[9] = new SqlParameter("@returnvalue", SqlDbType.VarChar); param[9].Size = 20; param[9].Direction = ParameterDirection.Output; int i = da.NExecuteNonQuery("Proc_InsertSalesArea_SalesOffice", param); string strMessage = Convert.ToString(param[8].Value); string strType = Convert.ToString(param[7].Value); string strRetValue = Convert.ToString(param[9].Value); objErrorHandler.Type = strType; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = strMessage.ToString(); objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); }
public ICollection <ErrorHandler> SaveSalesArea_SalesOffice(SalesArea_SalesOffice argSalesArea_SalesOffice) { List <ErrorHandler> lstErr = new List <ErrorHandler>(); DataAccess da = new DataAccess(); SalesAreaManager ObjSalesAreaManager = new SalesAreaManager(); try { if (ObjSalesAreaManager.blnIsSalesAreaExists(argSalesArea_SalesOffice.SalesOrganizationCode, argSalesArea_SalesOffice.DistChannelCode, argSalesArea_SalesOffice.DivisionCode, argSalesArea_SalesOffice.ClientCode) == true) { if (blnIsSalesArea_SalesOfficeExists(argSalesArea_SalesOffice.SalesOrganizationCode, argSalesArea_SalesOffice.DistChannelCode, argSalesArea_SalesOffice.DivisionCode, argSalesArea_SalesOffice.SalesofficeCode, argSalesArea_SalesOffice.ClientCode) == false) { da.Open_Connection(); da.BEGIN_TRANSACTION(); InsertSalesArea_SalesOffice(argSalesArea_SalesOffice, da, lstErr); foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { da.ROLLBACK_TRANSACTION(); return(lstErr); } } da.COMMIT_TRANSACTION(); } else { da.Open_Connection(); da.BEGIN_TRANSACTION(); UpdateSalesArea_SalesOffice(argSalesArea_SalesOffice, da, lstErr); foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { da.ROLLBACK_TRANSACTION(); return(lstErr); } } da.COMMIT_TRANSACTION(); } } else { objErrorHandler.Type = "E"; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = "Sales Area does not exists."; objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); } } catch (Exception ex) { if (da != null) { da.ROLLBACK_TRANSACTION(); } objErrorHandler.Type = ErrorConstant.strAboartType; objErrorHandler.MsgId = 0; objErrorHandler.Module = ErrorConstant.strInsertModule; objErrorHandler.ModulePart = ErrorConstant.strMasterModule; objErrorHandler.Message = ex.Message.ToString(); objErrorHandler.RowNo = 0; objErrorHandler.FieldName = ""; objErrorHandler.LogCode = ""; lstErr.Add(objErrorHandler); } finally { if (da != null) { da.Close_Connection(); da = null; } } return(lstErr); }