private Company_plant objCreateCompany_plant(DataRow dr) { Company_plant tCompany_plant = new Company_plant(); tCompany_plant.SetObjectInfo(dr); return(tCompany_plant); }
public ICollection <Company_plant> colGetCompany_plant(DataTable dt, string argUserName, string clientCode) { List <Company_plant> lst = new List <Company_plant>(); Company_plant objCompany_plant = null; foreach (DataRow dr in dt.Rows) { objCompany_plant = new Company_plant(); objCompany_plant.CompanyCode = Convert.ToString(dr["CompanyCode"]).Trim(); objCompany_plant.PlantCode = Convert.ToString(dr["PlantCode"]).Trim(); objCompany_plant.IsDeleted = Convert.ToInt32(dr["IsDeleted"]); objCompany_plant.ModifiedBy = Convert.ToString(argUserName).Trim(); objCompany_plant.CreatedBy = Convert.ToString(argUserName).Trim(); objCompany_plant.ClientCode = Convert.ToString(clientCode).Trim(); lst.Add(objCompany_plant); } return(lst); }
public void UpdateCompany_plant(Company_plant argCompany_plant, DataAccess da, List <ErrorHandler> lstErr) { SqlParameter[] param = new SqlParameter[8]; param[0] = new SqlParameter("@CompanyCode", argCompany_plant.CompanyCode); param[1] = new SqlParameter("@PlantCode", argCompany_plant.PlantCode); param[2] = new SqlParameter("@ClientCode", argCompany_plant.ClientCode); param[3] = new SqlParameter("@CreatedBy", argCompany_plant.CreatedBy); param[4] = new SqlParameter("@ModifiedBy", argCompany_plant.ModifiedBy); param[5] = new SqlParameter("@Type", SqlDbType.Char); param[5].Size = 1; param[5].Direction = ParameterDirection.Output; param[6] = new SqlParameter("@Message", SqlDbType.VarChar); param[6].Size = 255; param[6].Direction = ParameterDirection.Output; param[7] = new SqlParameter("@returnvalue", SqlDbType.VarChar); param[7].Size = 20; param[7].Direction = ParameterDirection.Output; int i = da.NExecuteNonQuery("Proc_UpdateCompany_plant", param); string strMessage = Convert.ToString(param[6].Value); string strType = Convert.ToString(param[5].Value); string strRetValue = Convert.ToString(param[7].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 Company_plant objGetCompany_plant(string argCompanyCode, string argPlantCode, string argClientCode) { Company_plant argCompany_plant = new Company_plant(); DataSet DataSetToFill = new DataSet(); if (argCompanyCode.Trim() == "") { goto ErrorHandlers; } if (argPlantCode.Trim() == "") { goto ErrorHandlers; } if (argClientCode.Trim() == "") { goto ErrorHandlers; } DataSetToFill = this.GetCompany_plant(argCompanyCode, argPlantCode, argClientCode); if (DataSetToFill.Tables[0].Rows.Count <= 0) { goto Finish; } argCompany_plant = this.objCreateCompany_plant((DataRow)DataSetToFill.Tables[0].Rows[0]); goto Finish; ErrorHandlers: Finish: DataSetToFill = null; return(argCompany_plant); }
public ICollection <Company_plant> colGetCompany_plant(string argClientCode) { List <Company_plant> lst = new List <Company_plant>(); DataSet DataSetToFill = new DataSet(); Company_plant tCompany_plant = new Company_plant(); DataSetToFill = this.GetCompany_plant(argClientCode); if (DataSetToFill != null) { foreach (DataRow dr in DataSetToFill.Tables[0].Rows) { lst.Add(objCreateCompany_plant(dr)); } } goto Finish; Finish: DataSetToFill = null; return(lst); }
public ICollection <ErrorHandler> SaveCompany_plant(Company_plant argCompany_plant) { List <ErrorHandler> lstErr = new List <ErrorHandler>(); DataAccess da = new DataAccess(); try { if (blnIsCompany_plantExists(argCompany_plant.CompanyCode, argCompany_plant.PlantCode, argCompany_plant.ClientCode) == false) { da.Open_Connection(); da.BEGIN_TRANSACTION(); InsertCompany_plant(argCompany_plant, 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(); UpdateCompany_plant(argCompany_plant, da, lstErr); foreach (ErrorHandler objerr in lstErr) { if (objerr.Type == "E") { da.ROLLBACK_TRANSACTION(); return(lstErr); } } da.COMMIT_TRANSACTION(); } } 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); }