Пример #1
0
        public SOType objGetSOType(string argSOTypeCode, string argClientCode)
        {
            SOType  argSOType     = new SOType();
            DataSet DataSetToFill = new DataSet();

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

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

            DataSetToFill = this.GetSOType(argSOTypeCode, argClientCode);

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

            argSOType = this.objCreateSOType((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argSOType);
        }
Пример #2
0
        private SOType objCreateSOType(DataRow dr)
        {
            SOType tSOType = new SOType();

            tSOType.SetObjectInfo(dr);

            return(tSOType);
        }
Пример #3
0
        public void UpdateSOType(SOType argSOType, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[16];
            param[0]  = new SqlParameter("@SOTypeCode", argSOType.SOTypeCode);
            param[1]  = new SqlParameter("@SOCategoryCode", argSOType.SOCategoryCode);
            param[2]  = new SqlParameter("@SOTypeDesc", argSOType.SOTypeDesc);
            param[3]  = new SqlParameter("@NumRange", argSOType.NumRange);
            param[4]  = new SqlParameter("@RangeFrom", argSOType.RangeFrom);
            param[5]  = new SqlParameter("@RangeTo", argSOType.RangeTo);
            param[6]  = new SqlParameter("@ItemCategoryCode", argSOType.ItemCategoryCode);
            param[7]  = new SqlParameter("@CRLimitCheckType", argSOType.CRLimitCheckType);
            param[8]  = new SqlParameter("@ItemNoIncr", argSOType.ItemNoIncr);
            param[9]  = new SqlParameter("@SaveMode", argSOType.SaveMode);
            param[10] = new SqlParameter("@ClientCode", argSOType.ClientCode);
            param[11] = new SqlParameter("@CreatedBy", argSOType.CreatedBy);
            param[12] = new SqlParameter("@ModifiedBy", argSOType.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[14].Value);
            string strType     = Convert.ToString(param[13].Value);
            string strRetValue = Convert.ToString(param[15].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);
        }
Пример #4
0
        public ICollection <SOType> colGetSOType(string argClientCode)
        {
            List <SOType> lst           = new List <SOType>();
            DataSet       DataSetToFill = new DataSet();
            SOType        tSOType       = new SOType();

            DataSetToFill = this.GetSOType(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Пример #5
0
        public ICollection <ErrorHandler> SaveSOType(SOType argSOType)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsSOTypeExists(argSOType.SOTypeCode, argSOType.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertSOType(argSOType, 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();
                    UpdateSOType(argSOType, 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);
        }