Ejemplo n.º 1
0
 public Database(IDb db, DbQueries dbQueries)
 {
     TableName = dbQueries.TableName.Split('.').Last();
     Schema = dbQueries.Schema;
     _dbQueries = dbQueries;
     _db = db;
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Hook up
            DependencyManager.InjectRavenDbContext(RavenContext.Instance);
            _db = DependencyManager.Db;
            _logger = DependencyManager.Logger;

            var action = Action.NotSet;

            Console.WriteLine("Choose action:");
            Console.WriteLine("1. Add ids to products");

            Console.WriteLine("");
            Console.WriteLine("--- Update scripts ---");

            var input = Console.ReadLine();

            action = (Action)Convert.ToInt32(input);

            if(action == Action.AddIdToProducts)
            {
             var products = _db.Products.GetAllProductsInDb();
                var en = products as Product[] ?? products.ToArray();
                foreach (var product in en)
                {
                    product.Enterprise = "enterprises-jessetinell";
                }
                _db.Products.UpdateProducts(en);
            }
        }
Ejemplo n.º 3
0
        public BaseController(IDb db, ILogger logger, IAuthentication authentication = null)
        {
            Db = db;
            Logger = logger;

            Authentication = authentication ?? DependencyManager.Authentication;
        }
Ejemplo n.º 4
0
 public void Execute(IDb db)
 {
     foreach (var record in db.Read(_selectStatement))
       {
     ExecuteScripts(record);
     db.Write(_updateStatement, (object)record);
       }
 }
Ejemplo n.º 5
0
        public void Setup()
        {
            var commandStub = new Mock<IDbCommand>().SetupAllProperties().Object;

            var connection = new Mock<IDbConnection>();
            connection.Setup(c => c.CreateCommand()).Returns(commandStub);
            _db = new Db(connection.Object);
   
        }
Ejemplo n.º 6
0
        internal Table(IDb Db, IDataReader DataReader)
        {
            _db = Db;

            _schemeName = (string)DataReader[ReaderSchemeNameField];

            _name = (string)DataReader[ReaderNameFieldName];

        }
Ejemplo n.º 7
0
 public override MultiResultSet<Person, Address> SelectPersonAndAddress(IDb db)
 {
     var query = "BEGIN\r\n" +
     $" OPEN :Cur1 FOR {SelectPeople}" +
     $" OPEN :Cur2 FOR {SelectAddresses};" +
     "END;";
     return db.Sql(query)
         .WithParameter(new OracleParameter("Cur1", OracleDbType.RefCursor, ParameterDirection.Output))
         .WithParameter(new OracleParameter("Cur2", OracleDbType.RefCursor, ParameterDirection.Output))
         .AsMultiResultSet<Person, Address>();
 }
Ejemplo n.º 8
0
 public SetupManager(
     IApplicationEnvironment appEnv,
     ILogger<SetupManager> logger,
     IOptions<SetupOptions> setupOptionsAccessor,
     IDb dbImplementation,
     IVersionProviderFactory versionProviderFactory,
     SiteManager siteManager)
 {
     appBasePath = appEnv.ApplicationBasePath;
     this.siteManager = siteManager;
     log = logger;
     db = dbImplementation;
     this.versionProviderFactory = versionProviderFactory;
     setupOptions = setupOptionsAccessor.Options;
 }
Ejemplo n.º 9
0
        public SystemInfoManager(
            IRuntimeEnvironment runtimeEnvironment,
            IHostingEnvironment hostingEnvironment,
            IApplicationEnvironment appEnvironment,
            IVersionProviderFactory versionProviderFactory,
            IDb database,
            ILogRepository logRepository)
        {
            runtimeInfo = runtimeEnvironment;
            appInfo = appEnvironment;
            hostingInfo = hostingEnvironment;
            db = database;
            logRepo = logRepository;
            versionProviders = versionProviderFactory;
            cloudscribeVersionProvider = versionProviders.Get("cloudscribe-core");


        }
Ejemplo n.º 10
0
 public static void Set(this IDb db, Keccak key, byte[] value)
 {
     db[key.Bytes] = value;
 }
Ejemplo n.º 11
0
 public static void Set(this IDb db, BigInteger key, byte[] value)
 {
     db[key.ToBigEndianByteArray()] = value;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="app">The current app</param>
 public CmsController(IApi api, IDb db, IModelLoader loader)
 {
     _api = api;
     _db = db;
     _loader = loader;
 }
Ejemplo n.º 13
0
 public TaskStatusRepository(IDb db, ILogger logger)
 {
     _db     = db;
     _logger = logger;
 }
        public void deleteOrderHistData(SqlLib lib, IDb db, object obj, ref DataTable outDt)
        {
            string sql = "";
            bool ret = true;

            try
            {
                OrderInfo orderInfo = new OrderInfo();
                ret = DataHandle.CompareObjectType(obj, orderInfo);

                if (ret)
                {
                    //get the correct list.
                    orderInfo = (OrderInfo)obj;
                }
                else
                {
                    return;
                }

                if (outDt == null)
                {
                    throw new NullReferenceException("outDt is null");
                }

                DataTable localDt = new DataTable();

                //每次删除一条或者多条.
                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetOrderInfo");

                if (!string.IsNullOrEmpty(orderInfo.ORDERID))
                {
                    sql = sql + " and ORDERID= '" + orderInfo.ORDERID + "'";
                }
                else
                {
                    //不允许都为空的情况,那样就全部删除了。抛出异常。
                    throw new NullReferenceException("产品详细关联号不可以为空!");
                }

                if (!string.IsNullOrEmpty(sql))
                {
                    localDt = db.GetTable(sql);
                }

                for (int i = 0; i < localDt.Rows.Count; i++)
                {
                    DataRow dr = localDt.Rows[i];

                    dr.Delete();
                }
                //ScmProviderData li = new ScmProviderData();

                //ret = DataHandle.CompareObjectType(obj, li);

                //if (ret)
                //{
                //    //get the correct list.
                //    li = (ScmProviderData)obj;
                //}
                //else
                //{
                //    return;
                //}

                //if (outDtPlace == null)
                //{
                //    throw new NullReferenceException("outDtPlace is null");
                //}

                //DataTable localDt = new DataTable();

                ////每次删除一条或者多条.
                //sql = lib.GetSql("SqlPlace/PlaceProdInfo", "GetPlaceProdRelationInfo");

                //if (!string.IsNullOrEmpty(li.PROVIDERID))
                //{
                //    sql = sql + " and PROVIDERID= '" + li.PROVIDERID + "'";
                //}
                //else
                //{
                //    //不允许都为空的情况,那样就全部删除了。抛出异常。
                //    throw new NullReferenceException("场所号和场所产品关联号不可以同时为空!");
                //}

                //if (!string.IsNullOrEmpty(sql))
                //{
                //    localDt = db.GetTable(sql);
                //}


                //for (int i = 0; i < localDt.Rows.Count; i++)
                //{
                //    DataRow dr = localDt.Rows[i];

                //    dr.Delete();
                //}

                //outDtPlace.Merge(localDt, true);

                outDt.Merge(localDt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteContractData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteContractData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteContractData" + ex.Message);
                throw;
            }
        }
Ejemplo n.º 15
0
 public JsonController(IDb db, ILogger logger)
     : base(db, logger)
 {
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db context</param>
 /// <param name="factory">The content service factory</param>
 public PageRepository(IDb db, IContentServiceFactory factory)
 {
     _db             = db;
     _contentService = factory.CreatePageService();
 }
        public void deleteInsuranceUsrData(SqlLib lib, IDb db, object obj, ref DataTable outInsuranceUsrDt)
        {
            string sql = "";
            bool ret = true;
            try
            {
                InsuranceUsrInfo InsuranceUsr = new InsuranceUsrInfo();
                ret = DataHandle.CompareObjectType(obj, InsuranceUsr);
                if (ret)
                {
                    InsuranceUsr = (InsuranceUsrInfo)obj;
                }
                else
                {
                    return;
                }
                if (outInsuranceUsrDt == null)
                {
                    throw new NullReferenceException("outInsuranceUsrDt is null");
                }
                DataTable localdt = new DataTable();
                sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetInsuranceUsrInfo");

                if (!string.IsNullOrEmpty(InsuranceUsr.INSURANCE_USRID))
                {
                    sql += " and INSURANCE_USRID='" + InsuranceUsr.INSURANCE_USRID + " '";
                }
                else
                {
                    throw new NullReferenceException("保单详细信息不能为空");
                }
                if (!string.IsNullOrEmpty(sql))
                {
                    localdt = db.GetTable(sql);
                }

                for (int i = 0; i < localdt.Rows.Count; i++)
                {
                    DataRow dr = localdt.Rows[i];
                    dr.Delete();
                }
                outInsuranceUsrDt.Merge(localdt);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteInsuranceUsrData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteInsuranceUsrData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteInsuranceUsrData" + ex.Message);
                throw;
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db context</param>
 /// <param name="cache">The optional model cache</param>
 public TagRepository(IDb db, ICache cache = null)
     : base(db, cache)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db connection</param>
 /// <param name="modelCache">The optional model cache</param>
 public PageRepository(Api api, IDb db, ICache modelCache = null)
 {
     this.api   = api;
     this.db    = db;
     this.cache = modelCache;
 }
Ejemplo n.º 20
0
 public PersistentTxStorage(IDb database)
 {
     _database = database;
 }
Ejemplo n.º 21
0
 public SnapshotableDb(IDb db)
 {
     _db = db;
 }
 public CategoryEquipmentRepository(ILogger logger)
 {
     _db     = new Db();
     _logger = logger;
 }
        public void addNewOrderDetData(SqlLib lib, IDb db, object obj, ref DataTable outOrderDetDt)
        {
            string sql = "";
            string localID = "";
            bool ret = false;
            try
            {
                OrderDetInfo li = new OrderDetInfo();
                ret = DataHandle.CompareObjectType(obj, li);
                if (ret)
                {
                    li = (OrderDetInfo)obj;
                }
                else
                {
                    return;
                }
                if (outOrderDetDt == null)
                {
                    throw new NullReferenceException("outOrderDetDt is null");
                }
                DataTable localDt = new DataTable();
                //只取一条记录,以便得到表结构,如果一条都没有,那么会有什么结果?能够取出表结构。
                sql = lib.GetSql("SqlOrderDetInfo/OrderDetInfo", "GetOrderDetStructInfo");
                localDt = db.GetTable(sql);

                //新增加的记录,在oracle中需要取到sequence编号
                sql = lib.GetSql("SqlOrderDetInfo/OrderDetInfo", "GetNewOrderDetId");
                DataTable dt = new DataTable();
                dt = db.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    localID = dt.Rows[0][0].ToString();
                    dt.Reset();
                }
                if (string.IsNullOrEmpty(localID))
                {
                    return;
                }
                DataRow dr = localDt.NewRow();
                dr["ORDERDETID"] = DataHandle.EmptyString2DBNull(localID);
                dr["ACCOUNTINGCOST"] = DataHandle.EmptyString2DBNull(li.ACCOUNTINGCOST);
                dr["BACKDT"] = DataHandle.EmptyString2DBNull(li.BACKDT);
                dr["BACKMONEY"] = DataHandle.EmptyString2DBNull(li.BACKMONEY);
                dr["BREASON"] = DataHandle.EmptyString2DBNull(li.BREASON);
                dr["CARDRIGHTNUM"] = DataHandle.EmptyString2DBNull(li.CARDRIGHTNUM);
                dr["CLEARFEE"] = DataHandle.EmptyString2DBNull(li.CLEARFEE);
                dr["CONTACTID"] = DataHandle.EmptyString2DBNull(li.CONTACTID);
                dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                dr["FBDT"] = DataHandle.EmptyString2DBNull(li.FBDT);
                dr["FEEDBACK"] = DataHandle.EmptyString2DBNull(li.FEEDBACK);
                dr["FREIGHT"] = DataHandle.EmptyString2DBNull(li.FREIGHT);
                dr["GOODSBACK"] = DataHandle.EmptyString2DBNull(li.GOODSBACK);
                dr["ISREFUND"] = DataHandle.EmptyString2DBNull(li.ISREFUND);
                dr["ORDERID"] = DataHandle.EmptyString2DBNull(li.ORDERID);
                dr["PAYMENT"] = DataHandle.EmptyString2DBNull(li.PAYMENT);
                dr["POSTFEE"] = DataHandle.EmptyString2DBNull(li.POSTFEE);
                dr["PRODBANKID"] = DataHandle.EmptyString2DBNull(li.PRODBANKID);
                dr["PRODDETID"] = DataHandle.EmptyString2DBNull(li.PRODDETID);
                dr["PRODNUM"] = DataHandle.EmptyString2DBNull(li.PRODNUM);
                dr["PRODUCTTYPE1"] = DataHandle.EmptyString2DBNull(li.PRODUCTTYPE1);
                dr["RECKONING"] = DataHandle.EmptyString2DBNull(li.RECKONING);
                dr["RECKONINGDT"] = DataHandle.EmptyString2DBNull(li.RECKONINGDT);
                dr["REFUNDDT"] = DataHandle.EmptyString2DBNull(li.REFUNDDT);
                dr["SOLDWITH"] = DataHandle.EmptyString2DBNull(li.SOLDWITH);
                dr["STATUS"] = DataHandle.EmptyString2DBNull(li.STATUS);
                dr["UPRICE"] = DataHandle.EmptyString2DBNull(li.UPRICE);

                localDt.Rows.Add(dr);
                outOrderDetDt.Merge(localDt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderDetData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderDetData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderDetData" + ex.Message);
                throw;
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db context</param>
 public AliasRepository(IDb db)
 {
     _db = db;
 }
        public void addNewInsuranceUsrData(SqlLib lib, IDb db, object obj, ref DataTable outInsuranceUsrDt)
        {
            string sql = "";
            string localID = "";
            bool ret = false;
            try
            {
                InsuranceUsrInfo li = new InsuranceUsrInfo();
                ret = DataHandle.CompareObjectType(obj, li);
                if (ret)
                {
                    li = (InsuranceUsrInfo)obj;
                }
                else
                {
                    return;
                }
                if (outInsuranceUsrDt == null)
                {
                    throw new NullReferenceException("outInsuranceUsrDt is null");
                }
                DataTable localdt = new DataTable();
                sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetInsuranceUsrStructInfo");
                localdt = db.GetTable(sql);

                sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetNewInsuranceUsrId");
                DataTable dt = new DataTable();
                dt = db.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    localID = dt.Rows[0][0].ToString();
                    dt.Reset();
                }
                if (string.IsNullOrEmpty(localID))
                {
                    return;
                }
                DataRow dr = localdt.NewRow();
                dr["INSURANCE_USRID"] = DataHandle.EmptyString2DBNull(localID);
                dr["Proportion"] = DataHandle.EmptyString2DBNull(li.Proportion);
                dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                dr["DSC"] = DataHandle.EmptyString2DBNull(li.DSC);
                dr["IDCARDNO"] = DataHandle.EmptyString2DBNull(li.IDCARDNO);
                dr["IDCARDTYPE"] = DataHandle.EmptyString2DBNull(li.IDCARDTYPE);
                dr["IDPERIOD"] = DataHandle.EmptyString2DBNull(li.IDPERIOD);
                dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                dr["NAME"] = DataHandle.EmptyString2DBNull(li.NAME);
                dr["POST"] = DataHandle.EmptyString2DBNull(li.POST);
                dr["PROFESSION"] = DataHandle.EmptyString2DBNull(li.PROFESSION);
                dr["SEX"] = DataHandle.EmptyString2DBNull(li.SEX);
                localdt.Rows.Add(dr);
                outInsuranceUsrDt.Merge(localdt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewInsuranceUsrData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewInsuranceUsrData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewInsuranceUsrData" + ex.Message);
                throw;
            }
        }
Ejemplo n.º 26
0
        public CliqueSealEngine(CliqueConfig config, IEthereumSigner signer, PrivateKey key, IDb blocksDb, IBlockTree blockTree, ILogManager logManager)
        {
            _logger    = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
            _config    = config ?? throw new ArgumentNullException(nameof(config));
            _blocksDb  = blocksDb ?? throw new ArgumentNullException(nameof(blocksDb));
            _signer    = signer ?? throw new ArgumentNullException(nameof(signer));
            _blockTree = blockTree ?? throw new ArgumentNullException();
            _key       = key ?? throw new ArgumentNullException(nameof(key));

            if (config.Epoch == 0)
            {
                config.Epoch = Clique.DefaultEpochLength;
            }
        }
        public void addNewOrderHistData(SqlLib lib, IDb db, object obj, ref DataTable outDt)
        {
            string sql = "";
            string localID = "";

            bool ret = false;

            try
            {
                OrderInfo li = new OrderInfo();

                ret = DataHandle.CompareObjectType(obj, li);

                if (ret)
                {
                    //get the correct list.
                    li = (OrderInfo)obj;
                }
                else
                {
                    return;
                }

                if (outDt == null)
                {
                    throw new NullReferenceException("outDt is null");
                }


                DataTable localDt = new DataTable();

                //只取一条记录,以便得到表结构,如果一条都没有,那么会有什么结果?能够取出表结构。
                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetOrderHistStructInfo");
                localDt = db.GetTable(sql);

                //新增加的记录,在oracle中需要取到sequence编号
                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetNewOrderHistId");
                DataTable dt = new DataTable();
                dt = db.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    localID = dt.Rows[0][0].ToString();
                    dt.Reset();
                }

                if (string.IsNullOrEmpty(localID))
                {
                    return;
                }

                DataRow dr = localDt.NewRow();

                dr["orderid"] = DataHandle.EmptyString2DBNull(localID);
                dr["contactid"] = DataHandle.EmptyString2DBNull(li.CONTACTID);
                dr["addressid"] = DataHandle.EmptyString2DBNull(li.ADDRESSID);

                dr["ACCDT"] = DataHandle.EmptyString2DBNull(li.ACCDT);
                dr["AMORTISATION"] = DataHandle.EmptyString2DBNull(li.AMORTISATION);
                dr["BENEFICIARIES"] = DataHandle.EmptyString2DBNull(li.BENEFICIARIES);
                dr["BILL"] = DataHandle.EmptyString2DBNull(li.BILL);
                dr["BILLDEMONDDSC"] = DataHandle.EmptyString2DBNull(li.BILLDEMONDDSC);
                dr["BILLDEMONDED"] = DataHandle.EmptyString2DBNull(li.BILLDEMONDED);
                dr["BILLTITLE"] = DataHandle.EmptyString2DBNull(li.BILLTITLE);
                dr["CARDID"] = DataHandle.EmptyString2DBNull(li.CARDID);
                dr["CARDRIGHTNUM"] = DataHandle.EmptyString2DBNull(li.CARDRIGHTNUM);
                dr["CLEARFEE"] = DataHandle.EmptyString2DBNull(li.CLEARFEE);

                dr["CONFIRM"] = DataHandle.EmptyString2DBNull(li.CONFIRM);
                dr["CONSIGNEE"] = DataHandle.EmptyString2DBNull(li.CONSIGNEE);
                dr["CONSIGNPHN"] = DataHandle.EmptyString2DBNull(li.CONSIGNPHN);
                dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                dr["DEMONDDT"] = DataHandle.EmptyString2DBNull(li.DEMONDDT);
                dr["DISCOUNT"] = DataHandle.EmptyString2DBNull(li.DISCOUNT);
                dr["FBDT"] = DataHandle.EmptyString2DBNull(li.FBDT);
                dr["GRPID"] = DataHandle.EmptyString2DBNull(li.GRPID);
                dr["HEALTHINTRO"] = DataHandle.EmptyString2DBNull(li.HEALTHINTRO);
                dr["INSURANCEID"] = DataHandle.EmptyString2DBNull(li.INSURANCEID);

                dr["INSURANT"] = DataHandle.EmptyString2DBNull(li.INSURANT);
                dr["MAILPRICE"] = DataHandle.EmptyString2DBNull(li.MAILPRICE);
                dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                dr["MONITORRECORDER"] = DataHandle.EmptyString2DBNull(li.MONITORRECORDER);
                dr["NOTE"] = DataHandle.EmptyString2DBNull(li.NOTE);
                dr["NOWMONEY"] = DataHandle.EmptyString2DBNull(li.NOWMONEY);
                dr["POLICYHOLDER"] = DataHandle.EmptyString2DBNull(li.POLICYHOLDER);
                dr["POSTFEE"] = DataHandle.EmptyString2DBNull(li.POSTFEE);
                dr["PRODPRICE"] = DataHandle.EmptyString2DBNull(li.PRODPRICE);

                dr["PRODUCTINTRO"] = DataHandle.EmptyString2DBNull(li.PRODUCTINTRO);
                dr["RESULT"] = DataHandle.EmptyString2DBNull(li.RESULT);
                dr["SENDDT"] = DataHandle.EmptyString2DBNull(li.SENDDT);
                dr["SPECIALDSC"] = DataHandle.EmptyString2DBNull(li.SPECIALDSC);
                dr["STATUS"] = DataHandle.EmptyString2DBNull(li.STATUS);
                dr["TOTALPRICE"] = DataHandle.EmptyString2DBNull(li.TOTALPRICE);
                dr["URGENT"] = DataHandle.EmptyString2DBNull(li.URGENT);
                dr["ordertype"] = DataHandle.EmptyString2DBNull(li.ordertype);
                dr["paytype"] = DataHandle.EmptyString2DBNull(li.paytype);
                dr["mailtype"] = DataHandle.EmptyString2DBNull(li.mailtype);
                dr["CRDT"] = DataHandle.EmptyString2DBNull(li.crdt);

                localDt.Rows.Add(dr);

                outDt.Merge(localDt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderHistData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderHistData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderHistData" + ex.Message);
                throw;
            }
        }
Ejemplo n.º 28
0
        public static Purchasing_PurchaseOrderTableQuery <Purchasing_PurchaseOrder> Purchasing_PurchaseOrders(this IDb db)
        {
            var query = new Purchasing_PurchaseOrderTableQuery <Purchasing_PurchaseOrder>(db as IDb);

            return(query);
        }
Ejemplo n.º 29
0
        public DomainLogicRoot(IProductWebpageDownloader productWebpageDownloader, IDb database)
        {
            var productPageParser = new ProductPageParser();

            GetHandler = new RequestHandler(productWebpageDownloader, productPageParser, database);
        }
Ejemplo n.º 30
0
 public Purchasing_PurchaseOrderTableQuery(IDb db) : base(db)
 {
 }
Ejemplo n.º 31
0
        public virtual void Exec(IDb db, string procName, string[] parameterName, object[] parameters, IList list)
        {
            int len = (parameters == null) ? 0 : parameters.Length;
            string sql = GetExecSql(procName);
            IDbCommand cmd = null;
            IDataReader reader = null;
            try
            {
                cmd = db.Connection.CreateCommand();
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Transaction = db.Transaction;
                
                db.AddParameters(cmd, parameterName, parameters, db.Transaction);

                TraceObject.Instance.TraceCommand(cmd);

                reader = cmd.ExecuteReader();
                FillByName(reader, list);
            }
            finally
            {
                if (reader != null)
                {
                    if (!reader.IsClosed)
                        reader.Close();
                    reader.Dispose();
                    reader = null;
                }
                if (cmd != null)
                {
                    cmd.Dispose();
                    cmd = null;
                }
            }
            FireTriggers(list, new TriggerEventArgs(db, Timing.AfterActivate));
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db connection</param>
 /// <param name="modelCache">The optional model cache</param>
 public PostRepository(Api api, IDb db, ICache modelCache = null) : base(api, db, modelCache)
 {
 }
Ejemplo n.º 33
0
 public TaskStatusRepository(ILogger logger)
 {
     _db     = new Db();
     _logger = logger;
 }
Ejemplo n.º 34
0
 public RosterHistoryService(IDb db)
 {
     _db = db;
 }
Ejemplo n.º 35
0
 public Tracer(IBlockchainProcessor processor, IReceiptStorage receiptStorage, IBlockTree blockTree, IDb traceDb)
 {
     _processor      = processor ?? throw new ArgumentNullException(nameof(processor));
     _receiptStorage = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
     _blockTree      = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     _traceDb        = traceDb ?? throw new ArgumentNullException(nameof(traceDb));
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db connection</param>
 /// <param name="modelCache">The optional model cache</param>
 protected ContentRepository(Api api, IDb db, ICache modelCache = null)
 {
     this.api   = api;
     this.db    = db;
     this.cache = modelCache;
 }
Ejemplo n.º 37
0
 public static void Delete(this IDb db, Keccak key)
 {
     db.Remove(key.Bytes);
 }
Ejemplo n.º 38
0
 public FillVisitor(SqlDataReader reader, IDb db, IObjectFillerFactory objectFillerFactory)
 {
     this.reader = reader;
     Db          = db;
     this.objectFillerFactory = objectFillerFactory;
 }
Ejemplo n.º 39
0
 public static byte[] Get(this IDb db, BigInteger key)
 {
     return(db[key.ToBigEndianByteArray()]);
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db connection</param>
 /// <param name="factory">The content service factory</param>
 public ContentRepository(IDb db, IContentServiceFactory factory)
 {
     _db      = db;
     _service = factory.CreateContentService();
 }
        public void updateOrderDetData(SqlLib lib, IDb db, object obj, ref DataTable outOrderDetDt)
        {
            string sql = "";
            bool ret = true;
            try
            {
                OrderDetInfo li = new OrderDetInfo();
                ret = DataHandle.CompareObjectType(obj, li);
                if (ret)
                {
                    li = (OrderDetInfo)obj;
                }
                else
                {
                    return;
                }
                if (outOrderDetDt == null)
                {
                    throw new NullReferenceException("outOrderDerDt is null");
                }
                DataTable localDt = new DataTable();
                //根据Id更新一条数据信息
                sql = lib.GetSql("SqlOrderDetInfo/OrderDetInfo", "GetOrderDetInfo");
                localDt = db.GetTable(sql);
                if (!string.IsNullOrEmpty(li.ORDERID))
                {
                    sql += " and ORDERDETID='" + li.ORDERDETID + "'";
                    localDt = db.GetTable(sql);
                    if (localDt.Rows.Count > 0)
                    {
                        DataRow dr = localDt.NewRow();
                        dr["ORDERDETID"] = DataHandle.EmptyString2DBNull(li.ORDERDETID);
                        dr["ACCOUNTINGCOST"] = DataHandle.EmptyString2DBNull(li.ACCOUNTINGCOST);
                        dr["BACKDT"] = DataHandle.EmptyString2DBNull(li.BACKDT);
                        dr["BACKMONEY"] = DataHandle.EmptyString2DBNull(li.BACKMONEY);
                        dr["BREASON"] = DataHandle.EmptyString2DBNull(li.BREASON);
                        dr["CARDRIGHTNUM"] = DataHandle.EmptyString2DBNull(li.CARDRIGHTNUM);
                        dr["CLEARFEE"] = DataHandle.EmptyString2DBNull(li.CLEARFEE);
                        dr["CONTACTID"] = DataHandle.EmptyString2DBNull(li.CONTACTID);
                        dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                        dr["FBDT"] = DataHandle.EmptyString2DBNull(li.FBDT);
                        dr["FEEDBACK"] = DataHandle.EmptyString2DBNull(li.FEEDBACK);
                        dr["FREIGHT"] = DataHandle.EmptyString2DBNull(li.FREIGHT);
                        dr["GOODSBACK"] = DataHandle.EmptyString2DBNull(li.GOODSBACK);
                        dr["ISREFUND"] = DataHandle.EmptyString2DBNull(li.ISREFUND);
                        dr["ORDERID"] = DataHandle.EmptyString2DBNull(li.ORDERID);
                        dr["PAYMENT"] = DataHandle.EmptyString2DBNull(li.PAYMENT);
                        dr["POSTFEE"] = DataHandle.EmptyString2DBNull(li.POSTFEE);
                        dr["PRODBANKID"] = DataHandle.EmptyString2DBNull(li.PRODBANKID);
                        dr["PRODDETID"] = DataHandle.EmptyString2DBNull(li.PRODDETID);
                        dr["PRODNUM"] = DataHandle.EmptyString2DBNull(li.PRODNUM);
                        dr["PRODUCTTYPE1"] = DataHandle.EmptyString2DBNull(li.PRODUCTTYPE1);
                        dr["RECKONING"] = DataHandle.EmptyString2DBNull(li.RECKONING);
                        dr["RECKONINGDT"] = DataHandle.EmptyString2DBNull(li.RECKONINGDT);
                        dr["REFUNDDT"] = DataHandle.EmptyString2DBNull(li.REFUNDDT);
                        dr["SOLDWITH"] = DataHandle.EmptyString2DBNull(li.SOLDWITH);
                        dr["STATUS"] = DataHandle.EmptyString2DBNull(li.STATUS);
                        dr["UPRICE"] = DataHandle.EmptyString2DBNull(li.UPRICE);
                        dr.EndEdit();
                        outOrderDetDt.Merge(localDt, true);
                    }
                }
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderDetData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderDetData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderDetData" + ex.Message);
                throw;
            }

        }
Ejemplo n.º 42
0
 public ReceiptRocksRepository(IDb database, IRlpNdmDecoder <DataDeliveryReceiptDetails> rlpDecoder)
 {
     _database   = database;
     _rlpDecoder = rlpDecoder;
 }
 public void updateInsuranceUsrData(SqlLib lib, IDb db, object obj, ref DataTable outInsuranceUsrDt)
 {
     string sql = "";
     bool ret = true;
     try
     {
         InsuranceUsrInfo li = new InsuranceUsrInfo();
         ret = DataHandle.CompareObjectType(obj, li);
         if (ret)
         {
             li = (InsuranceUsrInfo)obj;
         }
         else
         {
             return;
         }
         if (outInsuranceUsrDt == null)
         {
             throw new NullReferenceException("outInsuranceUsrDt is null");
         }
         DataTable localDt = new DataTable();
         //根据Id更新一条数据信息
         sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetInsuranceUsrInfo");
         localDt = db.GetTable(sql);
         if (!string.IsNullOrEmpty(li.INSURANCE_USRID))
         {
             sql += " and INSURANCE_USRID='" + li.INSURANCE_USRID + "'";
             localDt = db.GetTable(sql);
             if (localDt.Rows.Count > 0)
             {
                 DataRow dr = localDt.NewRow();
                 dr["INSURANCE_USRID"] = DataHandle.EmptyString2DBNull(li.INSURANCE_USRID);
                 dr["Proportion"] = DataHandle.EmptyString2DBNull(li.Proportion);
                 dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                 dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                 dr["DSC"] = DataHandle.EmptyString2DBNull(li.DSC);
                 dr["IDCARDNO"] = DataHandle.EmptyString2DBNull(li.IDCARDNO);
                 dr["IDCARDTYPE"] = DataHandle.EmptyString2DBNull(li.IDCARDTYPE);
                 dr["IDPERIOD"] = DataHandle.EmptyString2DBNull(li.IDPERIOD);
                 dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                 dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                 dr["NAME"] = DataHandle.EmptyString2DBNull(li.NAME);
                 dr["POST"] = DataHandle.EmptyString2DBNull(li.POST);
                 dr["PROFESSION"] = DataHandle.EmptyString2DBNull(li.PROFESSION);
                 dr["SEX"] = DataHandle.EmptyString2DBNull(li.SEX);
                 outInsuranceUsrDt.Merge(localDt, true);
             }
         }
     }
     catch (NullReferenceException ex)
     {
         CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderDetData" + ex.Message);
     }
     catch (ArrayTypeMismatchException ex)
     {
         CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderDetData" + ex.Message);
     }
     catch (Exception ex)
     {
         CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderDetData" + ex.Message);
         throw;
     }
 }
Ejemplo n.º 44
0
 public HospitalController(IDb service)
 {
     _service = service;
 }
        public bool updataInsuranceUsrDataTable(SqlLib lib, IDb db, DataTable indt)
        {
            bool ret = false;
            try
            {

                if (indt.Rows.Count == 0)
                {
                    //没有记录,相当于这方法没有执行。
                    return ret;
                }

                //更新OrderHist表
                //循环更新所有的。
                for (int i = 0; i < indt.Rows.Count; i++)
                {
                    DataRow dr = indt.Rows[i];

                    string localOrderid = "";

                    if (dr.RowState == DataRowState.Unchanged)
                    {
                        //do nothing.jump out the loop.
                        continue;
                    }
                    else
                        if (dr.RowState == DataRowState.Deleted)
                        {
                            //do nothing.
                        }
                        else
                        {
                            localOrderid = dr["INSURANCE_USRID"].ToString();
                        }

                    string sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetInsuranceUsrStructInfo");
                    CTrace.WriteLine(CTrace.TraceLevel.Info, "updateOrderDetDataTable sql={0}.", sql);

                    ret = db.Save(indt, sql);
                    CTrace.WriteLine(CTrace.TraceLevel.Info, "updataInsuranceUsrDataTable result={0}.", ret.ToString());
                    if (ret)
                    {
                        //return true.
                    }
                    else
                    {
                        db.Rollback();
                        localOrderid = "";
                        CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updataInsuranceUsrDataTable" + db.Error.Message);
                    }
                }

            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updataInsuranceUsrDataTable" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updataInsuranceUsrDataTable" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updataInsuranceUsrDataTable" + ex.Message);
                throw;
            }

            return ret;

        }
        public void deleteOrderHistAllInsurantData(SqlLib lib, IDb db, object obj, ref DataTable outInsuranceUsrDt)
        {
            string sql = "";
            bool ret = true;
            try
            {
                OrderInfo localOrderInfo = new OrderInfo();
                ret = DataHandle.CompareObjectType(obj, localOrderInfo);
                if (ret)
                {
                    localOrderInfo = (OrderInfo)obj;
                }
                else
                {
                    return;
                }
                if (outInsuranceUsrDt == null)
                {
                    throw new NullReferenceException("outInsuranceUsrDt is null");
                }

                string InsuranceUsrID = "";

                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetOrderHistInfo");
                sql = sql + string.Format(" and orderid = '{0}'", localOrderInfo.ORDERID);


                /// 保险人信息
                InsuranceUsrInfo localInsuranceUsrInfo = new InsuranceUsrInfo();

                CTrace.WriteLine(CTrace.TraceLevel.Info, "insurance.outOrderInfo sql={0}.", sql);
                DataTable dt = db.GetTable(sql);

                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow locaorderDr = dt.Rows[0];

                    localOrderInfo = DataRowToOrderModel(locaorderDr);

                    if (localOrderInfo.BENEFICIARIES != null && !string.IsNullOrEmpty(localOrderInfo.BENEFICIARIES))
                    {
                        InsuranceUsrID = "'" + localOrderInfo.BENEFICIARIES.ToString() + "',";
                    }
                    if (localOrderInfo.BENEFICIARIES2 !=null && !string.IsNullOrEmpty(localOrderInfo.BENEFICIARIES2))
                    {
                        InsuranceUsrID =  InsuranceUsrID +"'" + localOrderInfo.BENEFICIARIES2.ToString() + "',";
                    }
                    if (localOrderInfo.BENEFICIARIES3 != null && !string.IsNullOrEmpty(localOrderInfo.BENEFICIARIES3))
                    {
                        InsuranceUsrID = InsuranceUsrID + "'" + localOrderInfo.BENEFICIARIES3.ToString() + "',";
                    }
                    if (localOrderInfo.INSURANT != null && !string.IsNullOrEmpty(localOrderInfo.INSURANT))
                    {
                        InsuranceUsrID = InsuranceUsrID + "'" + localOrderInfo.INSURANT.ToString() + "',";
                    }
                    if (localOrderInfo.POLICYHOLDER !=null && !string.IsNullOrEmpty(localOrderInfo.POLICYHOLDER))
                    {
                        InsuranceUsrID = InsuranceUsrID + "'" + localOrderInfo.POLICYHOLDER.ToString() + "',";
                    }
                }


                if (string.IsNullOrEmpty(InsuranceUsrID))
                {
                    return;
                }
                DataTable localdt = new DataTable();
                sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetInsuranceUsrInfo");


                if (!string.IsNullOrEmpty(InsuranceUsrID))
                {
                    InsuranceUsrID = InsuranceUsrID.Substring(0, InsuranceUsrID.Length - 1);
                    sql += " and INSURANCE_USRID in (" + InsuranceUsrID + " )";
                }
                else
                {
                    throw new NullReferenceException("保单详细信息不能为空");
                }
                if (!string.IsNullOrEmpty(sql))
                {
                    localdt = db.GetTable(sql);
                }

                for (int i = 0; i < localdt.Rows.Count; i++)
                {
                    DataRow dr = localdt.Rows[i];
                    dr.Delete();
                }
                outInsuranceUsrDt.Merge(localdt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteInsuranceUsrData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteInsuranceUsrData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteInsuranceUsrData" + ex.Message);
                throw;
            }
        }
        public void updateOrderHistData(SqlLib lib, IDb db, object obj, ref DataTable outOrderHistDt)
        {
            string sql = "";
            bool ret = true;

            try
            {

                OrderInfo li = new OrderInfo();

                ret = DataHandle.CompareObjectType(obj, li);
                if (ret)
                {
                    //get the correct list.
                    li = (OrderInfo)obj;
                }
                else
                {
                    return;
                }

                if (outOrderHistDt == null)
                {
                    throw new NullReferenceException("outOrderHistDt is null");
                }


                DataTable localDt = new DataTable();
                //每次更新一条数据
                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetOrderInfo");
                if (!string.IsNullOrEmpty(li.ORDERID))
                {
                    sql = sql + " and orderid= '" + li.ORDERID + "'";
                    localDt = db.GetTable(sql);
                    if (localDt.Rows.Count == 1)
                    {
                        DataRow dr = localDt.Rows[0];
                        dr.BeginEdit();
                        dr["orderid"] = DataHandle.EmptyString2DBNull(li.ORDERID);
                        dr["contactid"] = DataHandle.EmptyString2DBNull(li.CONTACTID);
                        dr["addressid"] = DataHandle.EmptyString2DBNull(li.ADDRESSID);

                        dr["ACCDT"] = DataHandle.EmptyString2DBNull(li.ACCDT);
                        dr["AMORTISATION"] = DataHandle.EmptyString2DBNull(li.AMORTISATION);
                        dr["BENEFICIARIES"] = DataHandle.EmptyString2DBNull(li.BENEFICIARIES);
                        dr["BILL"] = DataHandle.EmptyString2DBNull(li.BILL);
                        dr["BILLDEMONDDSC"] = DataHandle.EmptyString2DBNull(li.BILLDEMONDDSC);
                        dr["BILLDEMONDED"] = DataHandle.EmptyString2DBNull(li.BILLDEMONDED);
                        dr["BILLTITLE"] = DataHandle.EmptyString2DBNull(li.BILLTITLE);
                        dr["CARDID"] = DataHandle.EmptyString2DBNull(li.CARDID);
                        dr["CARDRIGHTNUM"] = DataHandle.EmptyString2DBNull(li.CARDRIGHTNUM);
                        dr["CLEARFEE"] = DataHandle.EmptyString2DBNull(li.CLEARFEE);

                        dr["CONFIRM"] = DataHandle.EmptyString2DBNull(li.CONFIRM);
                        dr["CONSIGNEE"] = DataHandle.EmptyString2DBNull(li.CONSIGNEE);
                        dr["CONSIGNPHN"] = DataHandle.EmptyString2DBNull(li.CONSIGNPHN);
                        dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                        dr["DEMONDDT"] = DataHandle.EmptyString2DBNull(li.DEMONDDT);
                        dr["DISCOUNT"] = DataHandle.EmptyString2DBNull(li.DISCOUNT);
                        dr["FBDT"] = DataHandle.EmptyString2DBNull(li.FBDT);
                        dr["GRPID"] = DataHandle.EmptyString2DBNull(li.GRPID);
                        dr["HEALTHINTRO"] = DataHandle.EmptyString2DBNull(li.HEALTHINTRO);
                        dr["INSURANCEID"] = DataHandle.EmptyString2DBNull(li.INSURANCEID);

                        dr["INSURANT"] = DataHandle.EmptyString2DBNull(li.INSURANT);
                        dr["MAILPRICE"] = DataHandle.EmptyString2DBNull(li.MAILPRICE);
                        dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                        dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                        dr["MONITORRECORDER"] = DataHandle.EmptyString2DBNull(li.MONITORRECORDER);
                        dr["NOTE"] = DataHandle.EmptyString2DBNull(li.NOTE);
                        dr["NOWMONEY"] = DataHandle.EmptyString2DBNull(li.NOWMONEY);
                        dr["POLICYHOLDER"] = DataHandle.EmptyString2DBNull(li.POLICYHOLDER);
                        dr["POSTFEE"] = DataHandle.EmptyString2DBNull(li.POSTFEE);
                        dr["PRODPRICE"] = DataHandle.EmptyString2DBNull(li.PRODPRICE);

                        dr["PRODUCTINTRO"] = DataHandle.EmptyString2DBNull(li.PRODUCTINTRO);
                        dr["RESULT"] = DataHandle.EmptyString2DBNull(li.RESULT);
                        dr["SENDDT"] = DataHandle.EmptyString2DBNull(li.SENDDT);
                        dr["SPECIALDSC"] = DataHandle.EmptyString2DBNull(li.SPECIALDSC);
                        dr["STATUS"] = DataHandle.EmptyString2DBNull(li.STATUS);
                        dr["TOTALPRICE"] = DataHandle.EmptyString2DBNull(li.TOTALPRICE);
                        dr["URGENT"] = DataHandle.EmptyString2DBNull(li.URGENT);
                        dr["ordertype"] = DataHandle.EmptyString2DBNull(li.ordertype);
                        dr["paytype"] = DataHandle.EmptyString2DBNull(li.paytype);
                        dr["mailtype"] = DataHandle.EmptyString2DBNull(li.mailtype);
                        dr["CRDT"] = DataHandle.EmptyString2DBNull(li.crdt);
                        dr.EndEdit();
                        outOrderHistDt.Merge(localDt, true);
                    }
                    else
                    {
                        //do nothing
                    }
                }
                else
                {
                    //do nothing
                }

                //ScmProviderData li = new ScmProviderData();

                //ret = DataHandle.CompareObjectType(obj, li);

                //if (ret)
                //{
                //    //get the correct list.
                //    li = (ScmProviderData)obj;
                //}
                //else
                //{
                //    return;
                //}

                //if (outDtPlace == null)
                //{
                //    throw new NullReferenceException("outDtPlace is null");
                //}

                //DataTable localDt = new DataTable();

                ////每次更新一条。
                //sql = lib.GetSql("SqlPlace/PlaceProdInfo", "GetPlaceProdRelationInfo");

                //if (!string.IsNullOrEmpty(li.PROVIDERID))
                //{
                //    sql = sql + " and PROVIDERID= '" + li.PROVIDERID + "'";
                //    localDt = db.GetTable(sql);

                //    //have one record
                //    if (localDt.Rows.Count == 1)
                //    {
                //        // only one record.
                //        DataRow dr = localDt.Rows[0];

                //        dr.BeginEdit();
                //        dr["PROVIDERID"] = DataHandle.EmptyString2DBNull(li.PROVIDERID);

                //        dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                //        dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                //        dr["DSC"] = DataHandle.EmptyString2DBNull(li.DSC.ToString());


                //        dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                //        dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                //        dr["NAME"] = DataHandle.EmptyString2DBNull(li.NAME.ToString());
                //        dr.EndEdit();

                //        outDtPlace.Merge(localDt, true);
                //    }
                //    else
                //    {
                //        //do nothing.
                //    }
                //}
                //else
                //{
                //    // do nothing
                //}


            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderHistData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderHistData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in updateOrderHistData" + ex.Message);
                throw;
            }
        }
Ejemplo n.º 48
0
 public void SetUp()
 {
     unitOfWork = new UnitOfWork(sessionProvider);
     blogRepository = new Db(unitOfWork);
 }
        public void deleteOrderHistAllDetData(SqlLib lib, IDb db, object obj, ref DataTable outOrderDetDt)
        {
            string sql = "";
            bool ret = true;
            try
            {
                OrderInfo localOrderinfo = new OrderInfo();
                ret = DataHandle.CompareObjectType(obj, localOrderinfo);
                if (ret)
                {
                    localOrderinfo = (OrderInfo)obj;
                }
                else
                {
                    return;
                }
                if (outOrderDetDt == null)
                {
                    throw new NullReferenceException("outOrderDetInfo is null");
                }
                DataTable localdt = new DataTable();
                sql = lib.GetSql("SqlOrderDetInfo/OrderDetInfo", "GetOrderDetInfo");

                if (!string.IsNullOrEmpty(localOrderinfo.ORDERID))
                {
                    sql += " and ORDERID='" + localOrderinfo.ORDERID + "'";
                }
                else
                {
                    throw new NullReferenceException("保单信息不能为空");
                }
                if (!string.IsNullOrEmpty(sql))
                {
                    localdt = db.GetTable(sql);
                }

                for (int i = 0; i < localdt.Rows.Count; i++)
                {
                    DataRow dr = localdt.Rows[i];
                    dr.Delete();
                }

                outOrderDetDt.Merge(localdt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteOrderHistAllDetData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteOrderHistAllDetData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in deleteOrderHistAllDetData" + ex.Message);
                throw;
            }


        }
Ejemplo n.º 50
0
 public CabaretController(IDb db, ILogger logger)
     : base(db, logger) { }
Ejemplo n.º 51
0
 public ManageController(IDb db, ILogger logger)
     : base(db, logger)
 {
 }
Ejemplo n.º 52
0
		public TriggerEventArgs(IDb db, Timing timing) : base()
		{
			this.db = db;
			this.timing = timing;
		}
Ejemplo n.º 53
0
		public virtual object Find(IDb session, object key)
		{
			ErrorIfSPResult();
			SqlColumn pk = null;
			object result = null;
			foreach (SqlColumn c in columns)
			{
				if (c.IsPK)
				{
					pk = c;
					break;
				}
			}
			if (pk != null)
			{
				SqlQuery q = new SqlQuery();
				q.Constrain(pk.Alias).Equal(key);
				IList list = new ArrayList(1);
				Select(session, q, list);
				if (list.Count > 0)
					result = list[0];
			}
			return result;
		}
Ejemplo n.º 54
0
 public IIdQuery(IDb db)
     : base(db)
 {
 }
Ejemplo n.º 55
0
 public CommentApiController(IDb service)
 {
     _service = service;
 }
Ejemplo n.º 56
0
		public virtual void Exec(IDb db, string procName, object[] parameters, IList list)
		{
			int len = (parameters == null) ? 0 : parameters.Length;
			string sql = GetExecSql(procName, len);
			IDbCommand cmd = null;
			IDataReader reader = null;
			try
			{
				cmd = db.Connection.CreateCommand();
				cmd.CommandText = sql;
				cmd.CommandType = CommandType.Text;
				cmd.Transaction = db.Transaction;
				for (int i = 0; i < len; i++)
				{
					int j = i + 1;
					IDbDataParameter p = cmd.CreateParameter();
					p.ParameterName = string.Format("@{0}", j);
					SqlUtils.PrepParam(p, parameters[i]);
					cmd.Parameters.Add(p);
				}

				TraceObject.Instance.TraceCommand(cmd);
				
				reader = cmd.ExecuteReader();
				FillByName(reader, list);
			}
			finally
			{
				if (reader != null)
				{
					if (!reader.IsClosed)
						reader.Close();
					reader.Dispose();
					reader = null;
				}
				if (cmd != null)
				{
					cmd.Dispose();
					cmd = null;
				}
			}
			FireTriggers(list, new TriggerEventArgs(db, Timing.AfterActivate));
		}
Ejemplo n.º 57
0
 public DbTest(string name)
 {
     _target = DbTargetFactory.Create(name);
     _db = CreateDb();
 }
Ejemplo n.º 58
0
 public AccountingPolicyService(IDb db)
 {
     _table = db.GetTable <AccountingPolicy>();
 }
Ejemplo n.º 59
0
 public AccountController(IDb db, ILogger logger, IAuthentication authentication = null)
     : base(db, logger, authentication)
 {
 }
Ejemplo n.º 60
0
 public HomeController(IDb repository, ISendEmail mailRepo)
 {
     this.dbRepository = repository;
     this.sendEmail    = mailRepo;
 }