Beispiel #1
0
        public MatGroup_WarrantyTerm objGetMatGroup_WarrantyTerm(string argMaterialCode, string argMatGroup1Code, string argClientCode)
        {
            MatGroup_WarrantyTerm argMatGroup_WarrantyTerm = new MatGroup_WarrantyTerm();
            DataSet DataSetToFill = new DataSet();

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

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

            DataSetToFill = this.GetMatGroup_WarrantyTerm(argMaterialCode, argMatGroup1Code, argClientCode);

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

            argMatGroup_WarrantyTerm = this.objCreateMatGroup_WarrantyTerm((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argMatGroup_WarrantyTerm);
        }
Beispiel #2
0
        private MatGroup_WarrantyTerm objCreateMatGroup_WarrantyTerm(DataRow dr)
        {
            MatGroup_WarrantyTerm tMatGroup_WarrantyTerm = new MatGroup_WarrantyTerm();

            tMatGroup_WarrantyTerm.SetObjectInfo(dr);

            return(tMatGroup_WarrantyTerm);
        }
Beispiel #3
0
        public void UpdateMatGroup_WarrantyTerm(MatGroup_WarrantyTerm argMatGroup_WarrantyTerm, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[11];
            param[0] = new SqlParameter("@MatGroup1Code", argMatGroup_WarrantyTerm.MatGroup1Code);
            param[1] = new SqlParameter("@MaterialCode", argMatGroup_WarrantyTerm.MaterialCode);
            param[2] = new SqlParameter("@MastMaterialCode", argMatGroup_WarrantyTerm.MastMaterialCode);
            param[3] = new SqlParameter("@VendorWarTermsCode", argMatGroup_WarrantyTerm.VendorWarTermsCode);
            param[4] = new SqlParameter("@CustWarTermsCode", argMatGroup_WarrantyTerm.CustWarTermsCode);
            param[5] = new SqlParameter("@ClientCode", argMatGroup_WarrantyTerm.ClientCode);
            param[6] = new SqlParameter("@CreatedBy", argMatGroup_WarrantyTerm.CreatedBy);
            param[7] = new SqlParameter("@ModifiedBy", argMatGroup_WarrantyTerm.ModifiedBy);


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

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

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

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


            string strMessage  = Convert.ToString(param[9].Value);
            string strType     = Convert.ToString(param[8].Value);
            string strRetValue = Convert.ToString(param[10].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);
        }
Beispiel #4
0
        public ICollection <MatGroup_WarrantyTerm> colGetMatGroup_WarrantyTerm(string argClientCode)
        {
            List <MatGroup_WarrantyTerm> lst             = new List <MatGroup_WarrantyTerm>();
            DataSet DataSetToFill                        = new DataSet();
            MatGroup_WarrantyTerm tMatGroup_WarrantyTerm = new MatGroup_WarrantyTerm();

            DataSetToFill = this.GetMatGroup_WarrantyTerm(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Beispiel #5
0
        public ICollection <ErrorHandler> SaveMatGroup_WarrantyTerm(MatGroup_WarrantyTerm argMatGroup_WarrantyTerm)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsMatGroup_WarrantyTermExists("", argMatGroup_WarrantyTerm.MatGroup1Code, argMatGroup_WarrantyTerm.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertMatGroup_WarrantyTerm(argMatGroup_WarrantyTerm, 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_WarrantyTerm(argMatGroup_WarrantyTerm, 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);
        }