Пример #1
0
        public static void Init_from_DB()
        {
            if ((DateTime.Now - DTCpositionHeader_master.lastUpdateTime).TotalHours < Utility.RefreshInterval)
            {
                return;
            }

            DTCpositionHeader_master.Reset();
            DB_select selt = new DB_select(DTC_Position_Headers.Get_cmdTP());

            DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB());

            while (reader.Read())
            {
                DTC_Position_Headers dph = new DTC_Position_Headers();
                dph.Init_from_reader(reader);

                if (!DTCpositionHeader_master.modelNum_dic.ContainsKey(dph.ModelNumber.Value))
                {
                    List <DTC_Position_Headers> list = new List <DTC_Position_Headers>();
                    DTCpositionHeader_master.modelNum_dic[dph.ModelNumber.Value] = list;
                }
                DTCpositionHeader_master.modelNum_dic[dph.ModelNumber.Value].Add(dph);
            }
            reader.Close();

            DTCpositionHeader_master.lastUpdateTime = DateTime.Now;
        }
Пример #2
0
        public DTC_Position_Headers GetCopy()
        {
            DTC_Position_Headers newEntity = new DTC_Position_Headers();

            if (!this.ModelNumber.IsNull_flag)
            {
                newEntity.ModelNumber.Value = this.ModelNumber.Value;
            }
            if (!this.Country.IsNull_flag)
            {
                newEntity.Country.Value = this.Country.Value;
            }
            if (!this.Column_Header_Name.IsNull_flag)
            {
                newEntity.Column_Header_Name.Value = this.Column_Header_Name.Value;
            }
            if (!this.Table_Column.IsNull_flag)
            {
                newEntity.Table_Column.Value = this.Table_Column.Value;
            }
            if (!this.Rate_Desc.IsNull_flag)
            {
                newEntity.Rate_Desc.Value = this.Rate_Desc.Value;
            }
            if (!this.WHRate.IsNull_flag)
            {
                newEntity.WHRate.Value = this.WHRate.Value;
            }
            if (!this.ArmorColumn.IsNull_flag)
            {
                newEntity.ArmorColumn.Value = this.ArmorColumn.Value;
            }
            if (!this.Category.IsNull_flag)
            {
                newEntity.Category.Value = this.Category.Value;
            }
            if (!this.DiscloseType.IsNull_flag)
            {
                newEntity.DiscloseType.Value = this.DiscloseType.Value;
            }
            if (!this.SortOrder.IsNull_flag)
            {
                newEntity.SortOrder.Value = this.SortOrder.Value;
            }
            if (!this.ChargeBackFrom.IsNull_flag)
            {
                newEntity.ChargeBackFrom.Value = this.ChargeBackFrom.Value;
            }
            if (!this.LastModifiedBy.IsNull_flag)
            {
                newEntity.LastModifiedBy.Value = this.LastModifiedBy.Value;
            }
            if (!this.ModifiedDateTime.IsNull_flag)
            {
                newEntity.ModifiedDateTime.Value = this.ModifiedDateTime.Value;
            }
            return(newEntity);
        }
Пример #3
0
        internal HssUtility.SQLserver.DB_update Get_DBupdate()
        {
            if (!this.CheckValueChanges())
            {
                return(null);
            }

            HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(DTC_Position_Headers.Get_cmdTP());
            if (this.ModelNumber.ValueChanged)
            {
                upd.AddValue("ModelNumber", this.ModelNumber);
            }
            if (this.Country.ValueChanged)
            {
                upd.AddValue("Country", this.Country);
            }
            if (this.Column_Header_Name.ValueChanged)
            {
                upd.AddValue("Column_Header_Name", this.Column_Header_Name);
            }
            if (this.Table_Column.ValueChanged)
            {
                upd.AddValue("Table_Column", this.Table_Column);
            }
            if (this.Rate_Desc.ValueChanged)
            {
                upd.AddValue("Rate_Desc", this.Rate_Desc);
            }
            if (this.WHRate.ValueChanged)
            {
                upd.AddValue("WHRate", this.WHRate);
            }
            if (this.ArmorColumn.ValueChanged)
            {
                upd.AddValue("ArmorColumn", this.ArmorColumn);
            }
            if (this.Category.ValueChanged)
            {
                upd.AddValue("Category", this.Category);
            }
            if (this.DiscloseType.ValueChanged)
            {
                upd.AddValue("DiscloseType", this.DiscloseType);
            }
            if (this.SortOrder.ValueChanged)
            {
                upd.AddValue("SortOrder", this.SortOrder);
            }
            if (this.ChargeBackFrom.ValueChanged)
            {
                upd.AddValue("ChargeBackFrom", this.ChargeBackFrom);
            }
            if (this.LastModifiedBy.ValueChanged)
            {
                upd.AddValue("LastModifiedBy", this.LastModifiedBy);
            }
            if (this.ModifiedDateTime.ValueChanged)
            {
                upd.AddValue("ModifiedDateTime", this.ModifiedDateTime);
            }

            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("ID", HssUtility.General.RelationalOperator.Equals, this.pk_ID);
            upd.SetCondition(rela);

            return(upd);
        }
Пример #4
0
        internal HssUtility.SQLserver.DB_insert Get_DBinsert()
        {
            HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(DTC_Position_Headers.Get_cmdTP());

            dbIns.AddValue("ModelNumber", this.ModelNumber.Value);
            dbIns.AddValue("Country", this.Country.Value);
            dbIns.AddValue("Column_Header_Name", this.Column_Header_Name.Value);
            dbIns.AddValue("Table_Column", this.Table_Column.Value);
            dbIns.AddValue("Rate_Desc", this.Rate_Desc);     /*Optional 6*/
            dbIns.AddValue("WHRate", this.WHRate);           /*Optional 7*/
            dbIns.AddValue("ArmorColumn", this.ArmorColumn); /*Optional 8*/
            dbIns.AddValue("Category", this.Category.Value);
            dbIns.AddValue("DiscloseType", this.DiscloseType.Value);
            dbIns.AddValue("SortOrder", this.SortOrder.Value);
            dbIns.AddValue("ChargeBackFrom", this.ChargeBackFrom);     /*Optional 12*/
            dbIns.AddValue("LastModifiedBy", this.LastModifiedBy);     /*Optional 13*/
            dbIns.AddValue("ModifiedDateTime", this.ModifiedDateTime); /*Optional 14*/

            return(dbIns);
        }
Пример #5
0
        /// <summary>
        /// Initialize object from DB
        /// </summary>
        public bool Init_from_DB()
        {
            if (this.ID < 0)
            {
                return(false);
            }

            HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(DTC_Position_Headers.Get_cmdTP());
            db_sel.tableName = "DTC_Position_Headers";
            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("ID", HssUtility.General.RelationalOperator.Equals, this.ID);
            db_sel.SetCondition(rela);

            bool res_flag = false;

            HssUtility.SQLserver.DB_reader reader = new HssUtility.SQLserver.DB_reader(db_sel, Utility.Get_DRWIN_hDB());
            if (reader.Read())
            {
                this.Init_from_reader(reader);
                res_flag = true;
            }
            reader.Close();
            return(res_flag);
        }