Ejemplo n.º 1
0
        public MatGroup_StateSalesVat objGetMatGroup_StateSalesVat(int argVatID, string argClientCode)
        {
            MatGroup_StateSalesVat argMatGroup_StateSalesVat = new MatGroup_StateSalesVat();
            DataSet DataSetToFill = new DataSet();

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

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

            DataSetToFill = this.GetMatGroup_StateSalesVat(argVatID, argClientCode);

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

            argMatGroup_StateSalesVat = this.objCreateMatGroup_StateSalesVat((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argMatGroup_StateSalesVat);
        }
Ejemplo n.º 2
0
        private MatGroup_StateSalesVat objCreateMatGroup_StateSalesVat(DataRow dr)
        {
            MatGroup_StateSalesVat tMatGroup_StateSalesVat = new MatGroup_StateSalesVat();

            tMatGroup_StateSalesVat.SetObjectInfo(dr);

            return(tMatGroup_StateSalesVat);
        }
Ejemplo n.º 3
0
        public void UpdateMatGroup_StateSalesVat(MatGroup_StateSalesVat argMatGroup_StateSalesVat, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[12];
            param[0] = new SqlParameter("@VatID", argMatGroup_StateSalesVat.VatID);
            param[1] = new SqlParameter("@MatGroup1Code", argMatGroup_StateSalesVat.MatGroup1Code);
            param[2] = new SqlParameter("@StateCode", argMatGroup_StateSalesVat.StateCode);
            param[3] = new SqlParameter("@VatPer", argMatGroup_StateSalesVat.VatPer);
            param[4] = new SqlParameter("@ValidFrom", argMatGroup_StateSalesVat.ValidFrom);
            param[5] = new SqlParameter("@ValidTo", argMatGroup_StateSalesVat.ValidTo);
            param[6] = new SqlParameter("@ClientCode", argMatGroup_StateSalesVat.ClientCode);
            param[7] = new SqlParameter("@CreatedBy", argMatGroup_StateSalesVat.CreatedBy);
            param[8] = new SqlParameter("@ModifiedBy", argMatGroup_StateSalesVat.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[10].Value);
            string strType     = Convert.ToString(param[9].Value);
            string strRetValue = Convert.ToString(param[11].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_StateSalesVat> colGetMatGroup_StateSalesVat(string argClientCode)
        {
            List <MatGroup_StateSalesVat> lst = new List <MatGroup_StateSalesVat>();
            DataSet DataSetToFill             = new DataSet();
            MatGroup_StateSalesVat tMatGroup_StateSalesVat = new MatGroup_StateSalesVat();

            DataSetToFill = this.GetMatGroup_StateSalesVat(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Ejemplo n.º 5
0
        public ICollection <ErrorHandler> SaveMatGroup_StateSalesVat(MatGroup_StateSalesVat argMatGroup_StateSalesVat)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsMatGroup_StateSalesVatExists(argMatGroup_StateSalesVat.VatID, argMatGroup_StateSalesVat.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertMatGroup_StateSalesVat(argMatGroup_StateSalesVat, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateMatGroup_StateSalesVat(argMatGroup_StateSalesVat, 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);
        }