Пример #1
0
        public int Delete_CustodianID_dvdDetail(string reclaimFeeType)
        {
            DB_update upd = new DB_update(Dividend_Detail_full.Get_cmdTP());

            upd.AddNull("CustodianID");

            SQL_relation rela0 = new SQL_relation("DividendIndex", RelationalOperator.Equals, this.DividendIndex);

            if (string.IsNullOrEmpty(reclaimFeeType))
            {
                upd.SetCondition(rela0);
            }
            else
            {
                SQL_relation  rela1 = new SQL_relation("ReclaimFeesType", RelationalOperator.Equals, reclaimFeeType);
                SQL_condition cond  = new SQL_condition(rela0, ConditionalOperator.And, rela1);
                upd.SetCondition(cond);
            }

            Helper_SQLserver.AllTrigers("Dividend_Detail", false, Utility.Get_DRWIN_hDB());
            int count = upd.SaveToDB(Utility.Get_DRWIN_hDB());

            Helper_SQLserver.AllTrigers("Dividend_Detail", true, Utility.Get_DRWIN_hDB());

            return(count);
        }
Пример #2
0
        public int Update_to_DB()
        {
            if (dvdCust == null)
            {
                return(-1);
            }
            int count = 0, oneTimeAmount = Bulk_DBcmd.BatchAmount;

            DB_update upd = new DB_update(Dividend_Detail_simpleAP.Get_cmdTP());

            upd.AddValue("CustodianID", this.dvdCust.CustodianID);

            List <int> detailID_list = new List <int>(oneTimeAmount);

            foreach (Dividend_Detail_simpleAP dd in this.dd_list)
            {
                detailID_list.Add(dd.DetailID);

                if (detailID_list.Count >= oneTimeAmount)
                {
                    upd.SetCondition(new SQL_relation("DetailID", true, detailID_list));
                    count += upd.SaveToDB(Utility.Get_DRWIN_hDB());
                    detailID_list.Clear();
                }
            }

            if (detailID_list.Count > 0)
            {
                upd.SetCondition(new SQL_relation("DetailID", true, detailID_list));
                count += upd.SaveToDB(Utility.Get_DRWIN_hDB());
            }

            return(count);
        }
Пример #3
0
        public static int UpdateDetail_singleValue(int detailID, string colName, DateTime dt)
        {
            if (string.IsNullOrEmpty(colName))
            {
                return(-5);
            }
            if (dt < Utility.MinDate)
            {
                return(-6);
            }

            CmdTemplate cmdTp = new CmdTemplate();//create template for DB

            cmdTp.tableName = DividendDetail_master.Detail_tableName;
            cmdTp.AddColumn(DividendDetail_master.Detail_PK_colName);
            cmdTp.AddColumn(colName);

            DB_update upd = new DB_update(cmdTp);

            upd.AddValue(colName, dt);
            SQL_relation rela = new SQL_relation(DividendDetail_master.Detail_PK_colName, RelationalOperator.Equals, detailID);

            upd.SetCondition(rela);

            if (colName.Contains(" ") || colName.Contains("-"))
            {
                Helper_SQLserver.SetTriger(DividendDetail_master.Detail_tableName, "TR_Dividend_Detail_Audit_History", false, Utility.Get_DRWIN_hDB());
                int count = upd.SaveToDB(Utility.Get_DRWIN_hDB());
                Helper_SQLserver.SetTriger(DividendDetail_master.Detail_tableName, "TR_Dividend_Detail_Audit_History", true, Utility.Get_DRWIN_hDB());

                return(count);
            }
            else
            {
                int count = upd.SaveToDB(Utility.Get_DRWIN_hDB());
                return(count);
            }
        }