コード例 #1
0
ファイル: FrmEditBlackIP.cs プロジェクト: 15831944/winform-1
        /// <summary>
        /// 编辑状态下的数据保存
        /// </summary>
        /// <returns></returns>
        public override bool SaveUpdated()
        {
            BlackIPInfo info = BLLFactory <BlackIP> .Instance.FindById(Id);

            if (info != null)
            {
                SetInfo(info);

                try
                {
                    #region 更新数据
                    bool succeed = BLLFactory <BlackIP> .Instance.Update(info, info.Id);

                    if (succeed)
                    {
                        //可添加其他关联操作

                        return(true);
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmEditBlackIP));
                    MessageDxUtil.ShowError(ex.Message);
                }
            }
            return(false);
        }
コード例 #2
0
ファイル: FrmEditBlackIP.cs プロジェクト: 15831944/winform-1
        /// <summary>
        /// 数据显示的函数
        /// </summary>
        public override void DisplayData()
        {
            if (Id > 0)
            {
                #region 显示信息
                BlackIPInfo info = BLLFactory <BlackIP> .Instance.FindById(Id);

                if (info != null)
                {
                    tempInfo = info;//重新给临时对象赋值,使之指向存在的记录对象

                    txtName.Text = info.Name;
                    //txtAuthorizeType.SetComboBoxItem(info.AuthorizeType.ToString());
                    //txtForbid.Checked = info.IsForbid==0?false:true;
                    txtIPStart.Text = info.IPStart;
                    txtIPEnd.Text   = info.IPEnd;
                    txtNote.Text    = info.Remark;
                    txtCreator.Text = info.CreatorId.ToString();
                    txtCreateTime.SetDateTime(info.CreatorTime);
                }
                #endregion
            }
            else
            {
                txtCreator.Text        = Portal.gc.UserInfo.LoginName;        //默认为当前登录用户
                txtCreateTime.DateTime = DateTimeHelper.GetServerDateTime2(); //默认当前时间
            }

            RefreshUsers();
        }
コード例 #3
0
ファイル: FrmEditBlackIP.cs プロジェクト: 15831944/winform-1
        /// <summary>
        /// 新增状态下的数据保存
        /// </summary>
        /// <returns></returns>
        public override bool SaveAddNew()
        {
            BlackIPInfo info = tempInfo;//必须使用存在的局部变量,因为部分信息可能被附件使用

            SetInfo(info);
            //info.Creator = Portal.gc.UserInfo.LoginName;
            info.CreatorId   = Portal.gc.UserInfo.Id;
            info.CreatorTime = DateTimeHelper.GetServerDateTime2();

            try
            {
                #region 新增数据

                bool succeed = BLLFactory <BlackIP> .Instance.Insert(info);

                if (succeed)
                {
                    //可添加其他关联操作

                    return(true);
                }
                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmEditBlackIP));
                MessageDxUtil.ShowError(ex.Message);
            }
            return(false);
        }
コード例 #4
0
        /// <summary>
        /// 数据显示的函数
        /// </summary>
        public override void DisplayData()
        {
            InitDictItem();//数据字典加载(公用)

            if (!string.IsNullOrEmpty(ID))
            {
                #region 显示信息
                BlackIPInfo info = BLLFactory <BlackIP> .Instance.FindByID(ID);

                if (info != null)
                {
                    tempInfo = info;//重新给临时对象赋值,使之指向存在的记录对象

                    txtName.Text = info.Name;
                    txtAuthorizeType.SetComboBoxItem(info.AuthorizeType.ToString());
                    txtForbid.Checked = info.Forbid;
                    txtIPStart.Text   = info.IPStart;
                    txtIPEnd.Text     = info.IPEnd;
                    txtNote.Text      = info.Note;
                    txtCreator.Text   = info.Creator;
                    txtCreateTime.SetDateTime(info.CreateTime);
                }
                #endregion
            }
            else
            {
                txtCreator.Text        = Portal.gc.UserInfo.FullName;         //默认为当前登录用户
                txtCreateTime.DateTime = DateTimeHelper.GetServerDateTime2(); //默认当前时间
            }

            RefreshUsers();
        }
コード例 #5
0
ファイル: FrmEditBlackIP.cs プロジェクト: 15831944/winform-1
        /// <summary>
        /// 编辑或者保存状态下取值函数
        /// </summary>
        /// <param name="info"></param>
        private void SetInfo(BlackIPInfo info)
        {
            info.Name = txtName.Text;
            //info.AuthorizeType = Convert.ToInt16( txtAuthorizeType.GetComboBoxStrValue());
            //info.IsForbid = (short)(txtForbid.Checked?1:0);
            info.IPStart = txtIPStart.Text;
            info.IPEnd   = txtIPEnd.Text;
            info.Remark  = txtNote.Text;
            //info.Editor = Portal.gc.UserInfo.LoginName;
            info.EditorId       = Portal.gc.UserInfo.Id;
            info.LastUpdateTime = DateTimeHelper.GetServerDateTime2();

            info.CurrentLoginUserId = Portal.gc.UserInfo.Id; //记录当前登录的用户信息,供操作日志记录使用
        }
コード例 #6
0
        /// <summary>
        /// 编辑或者保存状态下取值函数
        /// </summary>
        /// <param name="info"></param>
        private void SetInfo(BlackIPInfo info)
        {
            info.Name          = txtName.Text;
            info.AuthorizeType = txtAuthorizeType.GetComboBoxStrValue().ToInt32();
            info.Forbid        = txtForbid.Checked;
            info.IPStart       = txtIPStart.Text;
            info.IPEnd         = txtIPEnd.Text;
            info.Note          = txtNote.Text;
            info.Editor        = Portal.gc.UserInfo.FullName;
            info.Editor_ID     = Portal.gc.UserInfo.ID.ToString();
            info.EditTime      = DateTimeHelper.GetServerDateTime2();

            info.CurrentLoginUserId = Portal.gc.UserInfo.ID; //记录当前登录的用户信息,供操作日志记录使用
        }
コード例 #7
0
ファイル: FrmEditBlackIP.cs プロジェクト: 15831944/winform-1
 public override void ClearScreen()
 {
     this.tempInfo = new BlackIPInfo();
     base.ClearScreen();
 }