Esempio n. 1
0
        public AccountGroup objGetAccountGroup(string argAccGroupCode, string argClientCode)
        {
            AccountGroup argAccountGroup = new AccountGroup();
            DataSet      DataSetToFill   = new DataSet();

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

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

            DataSetToFill = this.GetAccountGroup(argAccGroupCode, argClientCode);

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

            argAccountGroup = this.objCreateAccountGroup((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argAccountGroup);
        }
Esempio n. 2
0
        private AccountGroup objCreateAccountGroup(DataRow dr)
        {
            AccountGroup tAccountGroup = new AccountGroup();

            tAccountGroup.SetObjectInfo(dr);

            return(tAccountGroup);
        }
Esempio n. 3
0
        public void UpdateAccountGroup(AccountGroup argAccountGroup, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[9];
            param[0] = new SqlParameter("@AccGroupCode", argAccountGroup.AccGroupCode);
            param[1] = new SqlParameter("@GroupDesc", argAccountGroup.GroupDesc);
            param[2] = new SqlParameter("@AccCategoryCode", argAccountGroup.AccCategoryCode);
            param[3] = new SqlParameter("@ClientCode", argAccountGroup.ClientCode);
            param[4] = new SqlParameter("@CreatedBy", argAccountGroup.CreatedBy);
            param[5] = new SqlParameter("@ModifiedBy", argAccountGroup.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[7].Value);
            string strType     = Convert.ToString(param[6].Value);
            string strRetValue = Convert.ToString(param[8].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);
        }
Esempio n. 4
0
        public ICollection <AccountGroup> colGetAccountGroup(string argClientCode)
        {
            List <AccountGroup> lst           = new List <AccountGroup>();
            DataSet             DataSetToFill = new DataSet();
            AccountGroup        tAccountGroup = new AccountGroup();

            DataSetToFill = this.GetAccountGroup(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Esempio n. 5
0
        public ICollection <ErrorHandler> SaveAccountGroup(AccountGroup argAccountGroup)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsAccountGroupExists(argAccountGroup.AccGroupCode, argAccountGroup.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertAccountGroup(argAccountGroup, 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();
                    UpdateAccountGroup(argAccountGroup, 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);
        }