Пример #1
0
        private Material_ProfitCenter objCreateMaterial_ProfitCenter(DataRow dr)
        {
            Material_ProfitCenter tMaterial_ProfitCenter = new Material_ProfitCenter();

            tMaterial_ProfitCenter.SetObjectInfo(dr);

            return(tMaterial_ProfitCenter);
        }
Пример #2
0
        public Material_ProfitCenter objGetMaterial_ProfitCenter(string argProfitCenterCode, string argMaterialCode, string argPlantCode, string argClientCode)
        {
            Material_ProfitCenter argMaterial_ProfitCenter = new Material_ProfitCenter();
            DataSet DataSetToFill = new DataSet();

            if (argProfitCenterCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argMaterialCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argPlantCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argClientCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetMaterial_ProfitCenter(argProfitCenterCode, argMaterialCode, argPlantCode, argClientCode);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argMaterial_ProfitCenter = this.objCreateMaterial_ProfitCenter((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argMaterial_ProfitCenter);
        }
Пример #3
0
        public ICollection <Material_ProfitCenter> colGetMaterial_ProfitCenter(DataTable dt, string argUserName, string clientCode)
        {
            List <Material_ProfitCenter> lst = new List <Material_ProfitCenter>();
            Material_ProfitCenter        objMaterial_ProfitCenter = null;

            foreach (DataRow dr in dt.Rows)
            {
                objMaterial_ProfitCenter = new Material_ProfitCenter();
                objMaterial_ProfitCenter.MaterialCode     = Convert.ToString(dr["MaterialCode"]).Trim();
                objMaterial_ProfitCenter.ProfitCenterCode = Convert.ToString(dr["ProfitCenterCode"]).Trim();
                objMaterial_ProfitCenter.PlantCode        = Convert.ToString(dr["PlantCode"]).Trim();
                objMaterial_ProfitCenter.IsDeleted        = Convert.ToInt32(dr["IsDeleted"]);
                objMaterial_ProfitCenter.ModifiedBy       = Convert.ToString(argUserName).Trim();
                objMaterial_ProfitCenter.CreatedBy        = Convert.ToString(argUserName).Trim();
                objMaterial_ProfitCenter.ClientCode       = Convert.ToString(clientCode).Trim();
                lst.Add(objMaterial_ProfitCenter);
            }
            return(lst);
        }
Пример #4
0
        public void UpdateMaterial_ProfitCenter(Material_ProfitCenter argMaterial_ProfitCenter, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[9];
            param[0] = new SqlParameter("@ProfitCenterCode", argMaterial_ProfitCenter.ProfitCenterCode);
            param[1] = new SqlParameter("@MaterialCode", argMaterial_ProfitCenter.MaterialCode);
            param[2] = new SqlParameter("@PlantCode", argMaterial_ProfitCenter.PlantCode);
            param[3] = new SqlParameter("@ClientCode", argMaterial_ProfitCenter.ClientCode);
            param[4] = new SqlParameter("@CreatedBy", argMaterial_ProfitCenter.CreatedBy);
            param[5] = new SqlParameter("@ModifiedBy", argMaterial_ProfitCenter.ModifiedBy);

            param[6]           = new SqlParameter("@Type", SqlDbType.Char);
            param[6].Size      = 1;
            param[6].Direction = ParameterDirection.Output;

            param[7]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[7].Size      = 255;
            param[7].Direction = ParameterDirection.Output;

            param[8]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[8].Size      = 20;
            param[8].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_UpdateMaterial_ProfitCenter", param);


            string strMessage  = Convert.ToString(param[7].Value);
            string strType     = Convert.ToString(param[6].Value);
            string strRetValue = Convert.ToString(param[8].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);
        }
Пример #5
0
        public ICollection <Material_ProfitCenter> colGetMaterial_ProfitCenter(string argMaterialCode, string argClientCode)
        {
            List <Material_ProfitCenter> lst             = new List <Material_ProfitCenter>();
            DataSet DataSetToFill                        = new DataSet();
            Material_ProfitCenter tMaterial_ProfitCenter = new Material_ProfitCenter();

            DataSetToFill = this.GetMaterial_ProfitCenter(argMaterialCode, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateMaterial_ProfitCenter(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
Пример #6
0
        public ICollection <ErrorHandler> SaveMaterial_ProfitCenter(Material_ProfitCenter argMaterial_ProfitCenter)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsMaterial_ProfitCenterExists(argMaterial_ProfitCenter.ProfitCenterCode, argMaterial_ProfitCenter.MaterialCode, argMaterial_ProfitCenter.PlantCode, argMaterial_ProfitCenter.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertMaterial_ProfitCenter(argMaterial_ProfitCenter, 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();
                    UpdateMaterial_ProfitCenter(argMaterial_ProfitCenter, 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);
        }