예제 #1
0
        private TaxCatMaterial objCreateTaxCatMaterial(DataRow dr)
        {
            TaxCatMaterial tTaxCatMaterial = new TaxCatMaterial();

            tTaxCatMaterial.SetObjectInfo(dr);

            return(tTaxCatMaterial);
        }
예제 #2
0
        public void InsertTaxCatMaterial(TaxCatMaterial argTaxCatMaterial, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[10];
            param[0] = new SqlParameter("@TaxCategoryCode", argTaxCatMaterial.TaxCategoryCode);
            param[1] = new SqlParameter("@TaxCategoryDesc", argTaxCatMaterial.TaxCategoryDesc);
            param[2] = new SqlParameter("@TaxClassCode", argTaxCatMaterial.TaxClassCode);
            param[3] = new SqlParameter("@TaxClassDesc", argTaxCatMaterial.TaxClassDesc);
            param[4] = new SqlParameter("@ClientCode", argTaxCatMaterial.ClientCode);
            param[5] = new SqlParameter("@CreatedBy", argTaxCatMaterial.CreatedBy);
            param[6] = new SqlParameter("@ModifiedBy", argTaxCatMaterial.ModifiedBy);


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

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

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

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


            string strMessage  = Convert.ToString(param[8].Value);
            string strType     = Convert.ToString(param[7].Value);
            string strRetValue = Convert.ToString(param[9].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);
        }
예제 #3
0
        public TaxCatMaterial objGetTaxCatMaterial(string argTaxCategoryCode, string argTaxClassCode, string argClientCode)
        {
            TaxCatMaterial argTaxCatMaterial = new TaxCatMaterial();
            DataSet        DataSetToFill     = new DataSet();

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

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

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

            DataSetToFill = this.GetTaxCatMaterial(argTaxCategoryCode, argTaxClassCode, argClientCode);

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

            argTaxCatMaterial = this.objCreateTaxCatMaterial((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argTaxCatMaterial);
        }
예제 #4
0
        public ICollection <TaxCatMaterial> colGetTaxCatMaterial(string argClientCode)
        {
            List <TaxCatMaterial> lst      = new List <TaxCatMaterial>();
            DataSet        DataSetToFill   = new DataSet();
            TaxCatMaterial tTaxCatMaterial = new TaxCatMaterial();

            DataSetToFill = this.GetTaxCatMaterial(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
예제 #5
0
        public ICollection <ErrorHandler> SaveTaxCatMaterial(TaxCatMaterial argTaxCatMaterial)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsTaxCatMaterialExists(argTaxCatMaterial.TaxCategoryCode, argTaxCatMaterial.TaxClassCode, argTaxCatMaterial.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertTaxCatMaterial(argTaxCatMaterial, 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();
                    UpdateTaxCatMaterial(argTaxCatMaterial, 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);
        }