コード例 #1
0
        public IndustryMaster objGetIndustryMaster(string argIndustryName, string argClientCode)
        {
            IndustryMaster argIndustryMaster = new IndustryMaster();
            DataSet        DataSetToFill     = new DataSet();

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

            DataSetToFill = this.GetIndustryMaster(argIndustryName, argClientCode);

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

            argIndustryMaster = this.objCreateIndustryMaster((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argIndustryMaster);
        }
コード例 #2
0
        private IndustryMaster objCreateIndustryMaster(DataRow dr)
        {
            IndustryMaster tIndustryMaster = new IndustryMaster();

            tIndustryMaster.SetObjectInfo(dr);

            return(tIndustryMaster);
        }
コード例 #3
0
        public ICollection <IndustryMaster> colGetIndustryMaster(string argClientCode)
        {
            List <IndustryMaster> lst      = new List <IndustryMaster>();
            DataSet        DataSetToFill   = new DataSet();
            IndustryMaster tIndustryMaster = new IndustryMaster();

            DataSetToFill = this.GetIndustryMaster(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
コード例 #4
0
        public void InsertIndustryMaster(IndustryMaster argIndustryMaster, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[5];
            param[0] = new SqlParameter("@IndustryName", argIndustryMaster.IndustryName);
            param[1] = new SqlParameter("@ClientCode", argIndustryMaster.ClientCode);

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

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

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

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


            string strMessage  = Convert.ToString(param[3].Value);
            string strType     = Convert.ToString(param[2].Value);
            string strRetValue = Convert.ToString(param[4].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);
        }
コード例 #5
0
        public ICollection <ErrorHandler> SaveIndustryMaster(IndustryMaster argIndustryMaster)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsIndustryMasterExists(argIndustryMaster.IndustryName, argIndustryMaster.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertIndustryMaster(argIndustryMaster, 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();
                    UpdateIndustryMaster(argIndustryMaster, 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);
        }