Ejemplo n.º 1
0
        public MatGroup_ServiceLevel objGetMatGroup_ServiceLevel(int argLabourChrgID, string argClientCode)
        {
            MatGroup_ServiceLevel argMatGroup_ServiceLevel = new MatGroup_ServiceLevel();
            DataSet DataSetToFill = new DataSet();

            if (argLabourChrgID <= 0)
            {
                goto ErrorHandlers;
            }

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

            DataSetToFill = this.GetMatGroup_ServiceLevel(argLabourChrgID, argClientCode);

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

            argMatGroup_ServiceLevel = this.objCreateMatGroup_ServiceLevel((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argMatGroup_ServiceLevel);
        }
Ejemplo n.º 2
0
        private MatGroup_ServiceLevel objCreateMatGroup_ServiceLevel(DataRow dr)
        {
            MatGroup_ServiceLevel tMatGroup_ServiceLevel = new MatGroup_ServiceLevel();

            tMatGroup_ServiceLevel.SetObjectInfo(dr);

            return(tMatGroup_ServiceLevel);
        }
Ejemplo n.º 3
0
        public void UpdateMatGroup_ServiceLevel(MatGroup_ServiceLevel argMatGroup_ServiceLevel, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[14];

            param[0]  = new SqlParameter("@LabourChrgID", argMatGroup_ServiceLevel.LabourChrgID);
            param[1]  = new SqlParameter("@MatGroup1Code", argMatGroup_ServiceLevel.MatGroup1Code);
            param[2]  = new SqlParameter("@MaterialCode", argMatGroup_ServiceLevel.MaterialCode);
            param[3]  = new SqlParameter("@ServiceLevel", argMatGroup_ServiceLevel.ServiceLevel);
            param[4]  = new SqlParameter("@UnderWarLbChrg", argMatGroup_ServiceLevel.UnderWarLbChrg);
            param[5]  = new SqlParameter("@OutWarLbChrg", argMatGroup_ServiceLevel.OutWarLbChrg);
            param[6]  = new SqlParameter("@ValidFrom", argMatGroup_ServiceLevel.ValidFrom);
            param[7]  = new SqlParameter("@ValidTo", argMatGroup_ServiceLevel.ValidTo);
            param[8]  = new SqlParameter("@ClientCode", argMatGroup_ServiceLevel.ClientCode);
            param[9]  = new SqlParameter("@CreatedBy", argMatGroup_ServiceLevel.CreatedBy);
            param[10] = new SqlParameter("@ModifiedBy", argMatGroup_ServiceLevel.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[12].Value);
            string strType     = Convert.ToString(param[11].Value);
            string strRetValue = Convert.ToString(param[13].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);
        }
Ejemplo n.º 4
0
        public ICollection <MatGroup_ServiceLevel> colGetMatGroup_ServiceLevel(DataTable dt, string argUserName, string clientCode)
        {
            List <MatGroup_ServiceLevel> lst = new List <MatGroup_ServiceLevel>();
            MatGroup_ServiceLevel        objMatGroup_ServiceLevel = null;

            foreach (DataRow dr in dt.Rows)
            {
                objMatGroup_ServiceLevel = new MatGroup_ServiceLevel();
                objMatGroup_ServiceLevel.MatGroup1Code  = Convert.ToString(dr["MatGroup1Code"]).Trim();
                objMatGroup_ServiceLevel.ServiceLevel   = Convert.ToString(dr["ServiceLevel"]).Trim();
                objMatGroup_ServiceLevel.UnderWarLbChrg = Convert.ToDouble(dr["UnderWarLbChrg"]);
                objMatGroup_ServiceLevel.OutWarLbChrg   = Convert.ToDouble(dr["OutWarLbChrg"]);
                objMatGroup_ServiceLevel.ValidFrom      = Convert.ToString(dr["ValidFrom"]).Trim();
                objMatGroup_ServiceLevel.ValidTo        = Convert.ToString(dr["ValidTo"]).Trim();
                objMatGroup_ServiceLevel.MaterialCode   = Convert.ToString(dr["MaterialCode"].ToString().Trim());
                objMatGroup_ServiceLevel.IsDeleted      = Convert.ToInt32(dr["IsDeleted"]);
                objMatGroup_ServiceLevel.ModifiedBy     = Convert.ToString(argUserName).Trim();
                objMatGroup_ServiceLevel.CreatedBy      = Convert.ToString(argUserName).Trim();
                objMatGroup_ServiceLevel.ClientCode     = Convert.ToString(clientCode).Trim();
                lst.Add(objMatGroup_ServiceLevel);
            }
            return(lst);
        }
Ejemplo n.º 5
0
        public ICollection <MatGroup_ServiceLevel> colGetMatGroup_ServiceLevel(string argClientCode)
        {
            List <MatGroup_ServiceLevel> lst             = new List <MatGroup_ServiceLevel>();
            DataSet DataSetToFill                        = new DataSet();
            MatGroup_ServiceLevel tMatGroup_ServiceLevel = new MatGroup_ServiceLevel();

            DataSetToFill = this.GetMatGroup_ServiceLevel(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Ejemplo n.º 6
0
        public ICollection <ErrorHandler> SaveMatGroup_ServiceLevel(MatGroup_ServiceLevel argMatGroup_ServiceLevel)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsMatGroup_ServiceLevelExists(argMatGroup_ServiceLevel.LabourChrgID, argMatGroup_ServiceLevel.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertMatGroup_ServiceLevel(argMatGroup_ServiceLevel, 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();
                    UpdateMatGroup_ServiceLevel(argMatGroup_ServiceLevel, 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);
        }