コード例 #1
0
ファイル: DBADataAccess.cs プロジェクト: mwilian/demos
        public DBAInfo Get(
            String DB,
            ref string sErr)
        {
            DBAInfo objEntr = new DBAInfo();

            connect();
            InitSPCommand(_strSPGetName);
            AddParameter(DBAInfo.Field.DB.ToString(), DB);

            DataTable list = new DataTable();

            try
            {
                list = executeSelectSP(command);
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();

            if (list.Rows.Count > 0)
            {
                objEntr = (DBAInfo)GetDataFromDataRow(list, 0);
            }
            //if (dr != null) list = CBO.FillCollection(dr, ref list);
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(objEntr);
        }
コード例 #2
0
ファイル: DBADataAccess.cs プロジェクト: mwilian/demos
        public DataTableCollection Get_Page(DBAInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr)
        {
            string whereClause         = CreateWhereClause(obj);
            DataTableCollection dtList = null;

            connect();
            InitSPCommand(_strSPGetPages);

            AddParameter("WhereClause", whereClause);
            AddParameter("OrderBy", orderBy);
            AddParameter("PageIndex", pageIndex);
            AddParameter("PageSize", pageSize);

            try
            {
                dtList = executeCollectSelectSP();
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(dtList);
        }
コード例 #3
0
ファイル: DBAControl.cs プロジェクト: mwilian/demos
        public string InsertUpdate(DBAInfo obj)
        {
            string sErr = "";
            if (IsExist(
            obj.DB
			))
            {
                sErr = Update(obj);
            }
            else
                Add(obj, ref sErr);
            return sErr;
        }
コード例 #4
0
ファイル: DBADataAccess.cs プロジェクト: mwilian/demos
        /// <summary>
        /// Return 1: Table is exist Identity Field
        /// Return 0: Table is not exist Identity Field
        /// Return -1: Erro
        /// </summary>
        /// <param name="tableName"></param>
        public Int32 Add(DBAInfo objEntr, ref string sErr)
        {
            int ret = -1;

            connect();
            InitSPCommand(_strSPInsertName);
            AddParameter(DBAInfo.Field.DB.ToString(), objEntr.DB);
            AddParameter(DBAInfo.Field.DB1.ToString(), objEntr.DB1);
            AddParameter(DBAInfo.Field.DB2.ToString(), objEntr.DB2);
            AddParameter(DBAInfo.Field.DESCRIPTION.ToString(), objEntr.DESCRIPTION);
            AddParameter(DBAInfo.Field.DATE_FORMAT.ToString(), objEntr.DATE_FORMAT);
            AddParameter(DBAInfo.Field.DECIMAL_PLACES_SUNACCOUNT.ToString(), objEntr.DECIMAL_PLACES_SUNACCOUNT);
            AddParameter(DBAInfo.Field.DECIMAL_SEPERATOR.ToString(), objEntr.DECIMAL_SEPERATOR);
            AddParameter(DBAInfo.Field.THOUSAND_SEPERATOR.ToString(), objEntr.THOUSAND_SEPERATOR);
            AddParameter(DBAInfo.Field.PRIMARY_BUDGET.ToString(), objEntr.PRIMARY_BUDGET);
            AddParameter(DBAInfo.Field.DATA_ACCESS_GROUP.ToString(), objEntr.DATA_ACCESS_GROUP);
            AddParameter(DBAInfo.Field.DECIMAL_PLACES_SUNBUSINESS.ToString(), objEntr.DECIMAL_PLACES_SUNBUSINESS);
            AddParameter(DBAInfo.Field.REPORT_TEMPLATE_DRIVER.ToString(), objEntr.REPORT_TEMPLATE_DRIVER);
            AddParameter(DBAInfo.Field.PARAM_1.ToString(), objEntr.PARAM_1);
            AddParameter(DBAInfo.Field.PARAM_2.ToString(), objEntr.PARAM_2);
            AddParameter(DBAInfo.Field.PARAM_3.ToString(), objEntr.PARAM_3);
            AddParameter(DBAInfo.Field.PARAM_4.ToString(), objEntr.PARAM_4);
            AddParameter(DBAInfo.Field.PARAM_5.ToString(), objEntr.PARAM_5);
            AddParameter(DBAInfo.Field.PARAM_6.ToString(), objEntr.PARAM_6);

            try
            {
                //command.ExecuteNonQuery();
                object tmp = executeSPScalar();
                if (tmp != null && tmp != DBNull.Value)
                {
                    ret = Convert.ToInt32(tmp);
                }
                else
                {
                    ret = 0;
                }
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }

            return(ret);
        }
コード例 #5
0
ファイル: DBADataAccess.cs プロジェクト: mwilian/demos
        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            DBAInfo result = new DBAInfo();

            result.DB          = (dt.Rows[i][DBAInfo.Field.DB.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DB.ToString()]));
            result.DB1         = (dt.Rows[i][DBAInfo.Field.DB1.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DB1.ToString()]));
            result.DB2         = (dt.Rows[i][DBAInfo.Field.DB2.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DB2.ToString()]));
            result.DESCRIPTION = (dt.Rows[i][DBAInfo.Field.DESCRIPTION.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DESCRIPTION.ToString()]));
            result.DATE_FORMAT = (dt.Rows[i][DBAInfo.Field.DATE_FORMAT.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DATE_FORMAT.ToString()]));
            result.DECIMAL_PLACES_SUNACCOUNT  = (dt.Rows[i][DBAInfo.Field.DECIMAL_PLACES_SUNACCOUNT.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DECIMAL_PLACES_SUNACCOUNT.ToString()]));
            result.DECIMAL_SEPERATOR          = (dt.Rows[i][DBAInfo.Field.DECIMAL_SEPERATOR.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DECIMAL_SEPERATOR.ToString()]));
            result.THOUSAND_SEPERATOR         = (dt.Rows[i][DBAInfo.Field.THOUSAND_SEPERATOR.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.THOUSAND_SEPERATOR.ToString()]));
            result.PRIMARY_BUDGET             = (dt.Rows[i][DBAInfo.Field.PRIMARY_BUDGET.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PRIMARY_BUDGET.ToString()]));
            result.DATA_ACCESS_GROUP          = (dt.Rows[i][DBAInfo.Field.DATA_ACCESS_GROUP.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DATA_ACCESS_GROUP.ToString()]));
            result.DECIMAL_PLACES_SUNBUSINESS = (dt.Rows[i][DBAInfo.Field.DECIMAL_PLACES_SUNBUSINESS.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.DECIMAL_PLACES_SUNBUSINESS.ToString()]));
            result.REPORT_TEMPLATE_DRIVER     = (dt.Rows[i][DBAInfo.Field.REPORT_TEMPLATE_DRIVER.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.REPORT_TEMPLATE_DRIVER.ToString()]));
            if (dt.Columns.Contains(DBAInfo.Field.PARAM_1.ToString()))
            {
                result.PARAM_1 = (dt.Rows[i][DBAInfo.Field.PARAM_1.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PARAM_1.ToString()]));
            }
            if (dt.Columns.Contains(DBAInfo.Field.PARAM_2.ToString()))
            {
                result.PARAM_2 = (dt.Rows[i][DBAInfo.Field.PARAM_2.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PARAM_2.ToString()]));
            }
            if (dt.Columns.Contains(DBAInfo.Field.PARAM_3.ToString()))
            {
                result.PARAM_3 = (dt.Rows[i][DBAInfo.Field.PARAM_3.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PARAM_3.ToString()]));
            }
            if (dt.Columns.Contains(DBAInfo.Field.PARAM_4.ToString()))
            {
                result.PARAM_4 = (dt.Rows[i][DBAInfo.Field.PARAM_4.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PARAM_4.ToString()]));
            }
            if (dt.Columns.Contains(DBAInfo.Field.PARAM_5.ToString()))
            {
                result.PARAM_5 = (dt.Rows[i][DBAInfo.Field.PARAM_5.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PARAM_5.ToString()]));
            }
            if (dt.Columns.Contains(DBAInfo.Field.PARAM_6.ToString()))
            {
                result.PARAM_6 = (dt.Rows[i][DBAInfo.Field.PARAM_6.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][DBAInfo.Field.PARAM_6.ToString()]));
            }

            return(result);
        }
コード例 #6
0
ファイル: DBADataAccess.cs プロジェクト: mwilian/demos
        public string Update(DBAInfo objEntr)
        {
            connect();
            InitSPCommand(_strSPUpdateName);
            AddParameter(DBAInfo.Field.DB.ToString(), objEntr.DB);
            AddParameter(DBAInfo.Field.DB1.ToString(), objEntr.DB1);
            AddParameter(DBAInfo.Field.DB2.ToString(), objEntr.DB2);
            AddParameter(DBAInfo.Field.DESCRIPTION.ToString(), objEntr.DESCRIPTION);
            AddParameter(DBAInfo.Field.DATE_FORMAT.ToString(), objEntr.DATE_FORMAT);
            AddParameter(DBAInfo.Field.DECIMAL_PLACES_SUNACCOUNT.ToString(), objEntr.DECIMAL_PLACES_SUNACCOUNT);
            AddParameter(DBAInfo.Field.DECIMAL_SEPERATOR.ToString(), objEntr.DECIMAL_SEPERATOR);
            AddParameter(DBAInfo.Field.THOUSAND_SEPERATOR.ToString(), objEntr.THOUSAND_SEPERATOR);
            AddParameter(DBAInfo.Field.PRIMARY_BUDGET.ToString(), objEntr.PRIMARY_BUDGET);
            AddParameter(DBAInfo.Field.DATA_ACCESS_GROUP.ToString(), objEntr.DATA_ACCESS_GROUP);
            AddParameter(DBAInfo.Field.DECIMAL_PLACES_SUNBUSINESS.ToString(), objEntr.DECIMAL_PLACES_SUNBUSINESS);
            AddParameter(DBAInfo.Field.REPORT_TEMPLATE_DRIVER.ToString(), objEntr.REPORT_TEMPLATE_DRIVER);
            AddParameter(DBAInfo.Field.PARAM_1.ToString(), objEntr.PARAM_1);
            AddParameter(DBAInfo.Field.PARAM_2.ToString(), objEntr.PARAM_2);
            AddParameter(DBAInfo.Field.PARAM_3.ToString(), objEntr.PARAM_3);
            AddParameter(DBAInfo.Field.PARAM_4.ToString(), objEntr.PARAM_4);
            AddParameter(DBAInfo.Field.PARAM_5.ToString(), objEntr.PARAM_5);
            AddParameter(DBAInfo.Field.PARAM_6.ToString(), objEntr.PARAM_6);

            string sErr = "";

            try
            {
                excuteSPNonQuery();
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(sErr);
        }
コード例 #7
0
ファイル: DBADataAccess.cs プロジェクト: mwilian/demos
        private string CreateWhereClause(DBAInfo obj)
        {
            String result = "";

            return(result);
        }
コード例 #8
0
ファイル: DBAControl.cs プロジェクト: mwilian/demos
        public DataTable ToTransferInStruct()
        {
			DBAInfo inf = new DBAInfo();
            return inf.ToDataTable();
        }
コード例 #9
0
ファイル: DBAControl.cs プロジェクト: mwilian/demos
		public DataTableCollection Get_Page(DBAInfo obj, string orderBy, int pageIndex, int pageSize,ref String sErr)
        {
            return _objDAO.Get_Page(obj, orderBy, pageIndex, pageSize, ref sErr);
        }
コード例 #10
0
ファイル: DBAControl.cs プロジェクト: mwilian/demos
 public string Update(DBAInfo obj)
 {
     return _objDAO.Update(obj);
 }
コード例 #11
0
ファイル: DBAControl.cs プロジェクト: mwilian/demos
 public Int32 Add(DBAInfo obj, ref string sErr)
 {
     return _objDAO.Add(obj, ref sErr);
 }
コード例 #12
0
ファイル: DBAControl.cs プロジェクト: mwilian/demos
		public string TransferIn(DataRow row)
        {
            DBAInfo inf = new DBAInfo(row);
            return InsertUpdate(inf);
        }