예제 #1
0
        private Plant_ShippingPoint objCreatePlant_ShippingPoint(DataRow dr)
        {
            Plant_ShippingPoint tPlant_ShippingPoint = new Plant_ShippingPoint();

            tPlant_ShippingPoint.SetObjectInfo(dr);

            return(tPlant_ShippingPoint);
        }
예제 #2
0
        public ICollection <Plant_ShippingPoint> colGetPlant_ShippingPoint(DataTable dt, string argUserName, string clientCode)
        {
            List <Plant_ShippingPoint> lst = new List <Plant_ShippingPoint>();
            Plant_ShippingPoint        objPlant_ShippingPoint = null;

            foreach (DataRow dr in dt.Rows)
            {
                objPlant_ShippingPoint                   = new Plant_ShippingPoint();
                objPlant_ShippingPoint.PlantCode         = Convert.ToString(dr["PlantCode"]).Trim();
                objPlant_ShippingPoint.ShippingPointCode = Convert.ToString(dr["ShippingPointCode"]).Trim();
                objPlant_ShippingPoint.CreatedBy         = Convert.ToString(argUserName);
                objPlant_ShippingPoint.ModifiedBy        = Convert.ToString(argUserName);
                objPlant_ShippingPoint.ClientCode        = Convert.ToString(clientCode).Trim();
                lst.Add(objPlant_ShippingPoint);
            }
            return(lst);
        }
예제 #3
0
        public void UpdatePlant_ShippingPoint(Plant_ShippingPoint argPlant_ShippingPoint, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[8];
            param[0] = new SqlParameter("@PlantCode", argPlant_ShippingPoint.PlantCode);
            param[1] = new SqlParameter("@ShippingPointCode", argPlant_ShippingPoint.ShippingPointCode);
            param[2] = new SqlParameter("@ClientCode", argPlant_ShippingPoint.ClientCode);
            param[3] = new SqlParameter("@CreatedBy", argPlant_ShippingPoint.CreatedBy);
            param[4] = new SqlParameter("@ModifiedBy", argPlant_ShippingPoint.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_UpdatePlant_ShippingPoint", 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     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);
        }
예제 #4
0
        public Plant_ShippingPoint objGetPlant_ShippingPoint(string argPlantCode, string argShippingPointCode, string argClientCode)
        {
            Plant_ShippingPoint argPlant_ShippingPoint = new Plant_ShippingPoint();
            DataSet             DataSetToFill          = new DataSet();

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

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

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

            DataSetToFill = this.GetPlant_ShippingPoint(argPlantCode, argShippingPointCode, argClientCode);

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

            argPlant_ShippingPoint = this.objCreatePlant_ShippingPoint((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argPlant_ShippingPoint);
        }
예제 #5
0
        public ICollection <Plant_ShippingPoint> colGetPlant_ShippingPoint(string argClientCode)
        {
            List <Plant_ShippingPoint> lst           = new List <Plant_ShippingPoint>();
            DataSet             DataSetToFill        = new DataSet();
            Plant_ShippingPoint tPlant_ShippingPoint = new Plant_ShippingPoint();

            DataSetToFill = this.GetPlant_ShippingPoint(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
예제 #6
0
        public ICollection <ErrorHandler> SavePlant_ShippingPoint(Plant_ShippingPoint argPlant_ShippingPoint)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsPlant_ShippingPointExists(argPlant_ShippingPoint.PlantCode, argPlant_ShippingPoint.ShippingPointCode, argPlant_ShippingPoint.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertPlant_ShippingPoint(argPlant_ShippingPoint, 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();
                    UpdatePlant_ShippingPoint(argPlant_ShippingPoint, 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);
        }