Beispiel #1
0
        internal HssUtility.SQLserver.DB_update Get_DBupdate()
        {
            if (!this.CheckValueChanges())
            {
                return(null);
            }
            else
            {
                this.LastModifyAt.Value = DateTime.Now;
            }

            HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(Hss_UserConfig.Get_cmdTP());
            if (this.UserName.ValueChanged)
            {
                upd.AddValue("UserName", this.UserName);                            /*Optional 2*/
            }
            if (this.ConfigXML.ValueChanged)
            {
                upd.AddValue("ConfigXML", this.ConfigXML);                             /*Optional 3*/
            }
            if (this.LastModifyAt.ValueChanged)
            {
                upd.AddValue("LastModifyAt", this.LastModifyAt);                                /*Optional 4*/
            }
            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("ID", HssUtility.General.RelationalOperator.Equals, this.pk_ID);
            upd.SetCondition(rela);

            return(upd);
        }
Beispiel #2
0
 /********************************************************************************************************/
 private static void Init_userConfig_fromDB()
 {
     if (UserConfigMaster.userConfig == null)
     {
         UserConfigMaster.userConfig = new Hss_UserConfig(Utility.CurrentUser);
         UserConfigMaster.userConfig.Init_from_DB();
         UserConfigMaster.userConfig.Init_from_ConfigXML();
     }
 }
Beispiel #3
0
        public Hss_UserConfig GetCopy()
        {
            Hss_UserConfig newEntity = new Hss_UserConfig();

            if (!this.UserName.IsNull_flag)
            {
                newEntity.UserName.Value = this.UserName.Value;
            }
            if (!this.ConfigXML.IsNull_flag)
            {
                newEntity.ConfigXML.Value = this.ConfigXML.Value;
            }
            if (!this.LastModifyAt.IsNull_flag)
            {
                newEntity.LastModifyAt.Value = this.LastModifyAt.Value;
            }
            return(newEntity);
        }
Beispiel #4
0
        /// <summary>
        /// Initialize object from DB
        /// </summary>
        public bool Init_from_DB()
        {
            HssUtility.SQLserver.SQL_relation rela = null;
            if (this.pk_ID > 0)
            {
                rela = new HssUtility.SQLserver.SQL_relation("ID", HssUtility.General.RelationalOperator.Equals, this.ID);
            }
            else
            {
                if (UserName.IsValueEmpty)
                {
                    return(false);
                }
                else
                {
                    rela = new HssUtility.SQLserver.SQL_relation("UserName", HssUtility.General.RelationalOperator.Equals, this.UserName.Value);
                }
            }

            HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(Hss_UserConfig.Get_cmdTP());
            db_sel.tableName = "Hss_UserConfig";
            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);
        }
Beispiel #5
0
        internal HssUtility.SQLserver.DB_insert Get_DBinsert()
        {
            this.LastModifyAt.Value = DateTime.Now;

            HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(Hss_UserConfig.Get_cmdTP());
            dbIns.AddValue("UserName", this.UserName);         /*Optional 2*/
            dbIns.AddValue("ConfigXML", this.ConfigXML);       /*Optional 3*/
            dbIns.AddValue("LastModifyAt", this.LastModifyAt); /*Optional 4*/
            return(dbIns);
        }