private void tmrTask_Tick(object sender, EventArgs e)
        {
            // 前提是用户已经登录系统了
            if (BaseSystemInfo.UserIsLogOn)
            {
                // 当退出程序时把当前用户的状态修改为离线状态
                if (BaseSystemInfo.CheckOnLine || (BaseSystemInfo.OnLineLimit > 0))
                {
                    try
                    {
                        // 每次都建立一个新的链接
                        DotNetService serviceManager = new DotNetService();
                        serviceManager.LogOnService.OnLine(this.UserInfo, 1);

                        // 每次都采用同一个连接,可能会有超时问题导致
                        // DotNetService.Instance.LogOnService.OnLine(this.UserInfo);
                    }
                    catch (System.Exception ex)
                    {
                        this.WriteException(ex);
                        System.Console.WriteLine(ex.InnerException);
                    }
                }
            }
        }
        private void btnSend_Click(object sender, EventArgs e)
        {
            StringBuilder sbmy = new StringBuilder();

            sbmy.Append("<div style='margin:2px;padding:0px 0px 0px 15px;" +
                        "font-family:" + this.txtContents.Font.FontFamily.Name + ";" +
                        "font-size:" +
                        this.txtContents.Font.Size + "pt;color:#" +
                        this.txtContents.ForeColor.R.ToString("X2") +
                        this.txtContents.ForeColor.G.ToString("X2") +
                        this.txtContents.ForeColor.B.ToString("X2"));
            sbmy.Append(";font-weight:");
            sbmy.Append(this.txtContents.Font.Bold ? "bold" : "");
            sbmy.Append(";font-style:");
            sbmy.Append(this.txtContents.Font.Italic ? "italic" : "");
            sbmy.Append(";'>");
            sbmy.Append(GetHtmlHref(this.txtContents.Text) + "</div>");

            DotNetService dotNetService = new DotNetService();

            // 发送信息
            dotNetService.MessageService.Broadcast(UserInfo, sbmy.ToString());
            if (dotNetService.MessageService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.MessageService).Close();
            }
            // 2010-12-15 发好信息了,还是关闭了比较好
            // this.txtContent.Clear();
            // this.txtContent.Focus();
            this.Close();
        }
 /// <summary>
 /// 允许登录次数已经到了
 /// </summary>
 /// <returns>继续允许输入</returns>
 private bool CheckAllowLogOnCount()
 {
     if (this.LogOnCount >= BaseSystemInfo.PasswordErrowLockLimit)
     {
         // 控件重新设置状态
         this.txtPassword.Clear();
         this.txtUser.Enabled     = false;
         this.txtPassword.Enabled = false;
         this.btnConfirm.Enabled  = false;
         // 若是强类型的密码管理
         if (BaseSystemInfo.CheckPasswordStrength)
         {
             // 防止被黑客攻击,帐户被锁定 15分钟后才可以用
             string        userName      = this.txtUser.Text;
             DotNetService dotNetService = new DotNetService();
             dotNetService.LogOnService.LockUser(UserInfo, userName);
             if (dotNetService.LogOnService is ICommunicationObject)
             {
                 ((ICommunicationObject)dotNetService.LogOnService).Close();
             }
             // 提示帐户被锁定
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0400, BaseSystemInfo.LockUserPasswordError.ToString()), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             // 进行提示信息,不能再输入了,已经错误N次了。
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0211, BaseSystemInfo.PasswordErrowLockLimit.ToString()), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         return(false);
     }
     return(true);
 }
        /// <summary>
        /// 清除日志
        /// </summary>
        private void ClearException()
        {
            // 设置鼠标繁忙状态,并保留原先的状态
            Cursor holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            try
            {
                DotNetService dotNetService = new DotNetService();
                dotNetService.ExceptionService.Truncate(this.UserInfo);
                if (dotNetService.ExceptionService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.ExceptionService).Close();
                }
                MessageBox.Show(AppMessage.MSG0238, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                this.ProcessException(ex);
            }
            finally
            {
                // 设置鼠标默认状态,原来的光标状态
                this.Cursor = holdCursor;
            }
        }
 private void grdExceptionAdmin_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     // 判断是否有删除权限
     if (!this.permissionDelete)
     {
         e.Cancel = true;
         return;
     }
     else
     {
         if (MessageBox.Show(AppMessage.MSG0015, AppMessage.MSG0000, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
         {
             e.Cancel = true;
         }
         else
         {
             DotNetService dotNetService = new DotNetService();
             dotNetService.ExceptionService.Delete(this.UserInfo, this.EntityId);
             if (dotNetService.ExceptionService is ICommunicationObject)
             {
                 ((ICommunicationObject)dotNetService.ExceptionService).Close();
             }
         }
     }
 }
Exemple #6
0
        public override void FormOnLoad()
        {
            this.BindItemDetails();
            // 是否锁定系统
            DotNetService dotNetService = new DotNetService();
            string        isLockSystem  = dotNetService.ParameterService.GetParameter(UserInfo, "User", UserInfo.Id, "IsLockSystem");
            // 锁定等待时间
            string lockWaitMinute = dotNetService.ParameterService.GetParameter(UserInfo, "User", UserInfo.Id, "LockWaitMinute");

            if (dotNetService.ParameterService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.ParameterService).Close();
            }
            // 这里是需要保证,默认是选中的,只有被确认过不选,才是不选才对
            this.ckbIsLock.Checked = (isLockSystem == false.ToString() ? false : true);
            // 这里也要保证,屏幕上的默认值能保存,只有客户设置过参数才读取客户的参数
            if (!string.IsNullOrEmpty(lockWaitMinute))
            {
                this.cmbLockWaitMinute.SelectedValue = lockWaitMinute;
            }
            if (this.Owner != null)
            {
                this.Owner.Opacity = 0;
            }
        }
Exemple #7
0
        /// <summary>
        /// 获取授权范围数据 (按道理,应该是在某个数据区域上起作用)
        /// </summary>
        public DataTable GetPermissionItemScop(string permissionItemScopeCode)
        {
            // 获取部门数据
            DataTable     dtPermissionItem = new DataTable(BasePermissionItemEntity.TableName);
            DotNetService dotNetService    = new DotNetService();

            if (UserInfo.IsAdministrator)
            {
                dtPermissionItem = dotNetService.PermissionItemService.GetDataTable(UserInfo);
                if (dotNetService.PermissionItemService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.PermissionItemService).Close();
                }
                // 这里需要只把有效的模块显示出来
                // BaseBusinessLogic.SetFilter(dtPermissionItem, BasePermissionItemEntity.FieldEnabled, "1");
                // 未被打上删除标标志的
                // BaseBusinessLogic.SetFilter(dtPermissionItem, BasePermissionItemEntity.FieldDeletionStateCode, "0");
            }
            else
            {
                dtPermissionItem = dotNetService.PermissionService.GetPermissionItemDTByPermissionScope(UserInfo, UserInfo.Id, permissionItemScopeCode);
                if (dotNetService.PermissionService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.PermissionService).Close();
                }
                BaseInterfaceLogic.CheckTreeParentId(dtPermissionItem, BasePermissionItemEntity.FieldId, BasePermissionItemEntity.FieldParentId);
            }
            return(dtPermissionItem);
        }
        public void DataBind()
        {
            this.FormLoaded = false;
            DotNetService dotNetService = new DotNetService();
            DataTable     dataTable     = dotNetService.ItemDetailsService.GetDataTable(this.UserInfo, this.TargetTableName);

            if (dotNetService.ItemDetailsService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.ItemDetailsService).Close();
            }
            // 绑定数据
            this.cmbItemDetail.DisplayMember = this.DisplayMember;
            this.cmbItemDetail.ValueMember   = this.ValueMember;
            this.cmbItemDetail.DataSource    = dataTable.DefaultView;
            if (this.AllowNull)
            {
                // 添加一个空记录
                DataRow dataRow = dataTable.NewRow();
                dataTable.Rows.InsertAt(dataRow, 0);
                this.cmbItemDetail.SelectedValue = dataRow;
            }
            this.SetSelectedValue(this.SelectedId);
            // this.AllowAdmin = UserInfo.IsAdministrator;
            // 默认绑定,没有进行选择时,也需要读取值,否则会不正确。
            this.GetSelectedValue();
            // 设置按钮状态
            this.SetControlState();
            this.FormLoaded = true;
        }
Exemple #9
0
 public BuildDotNetCommand(RabbitMessage receiver, DotNetService service, DiscoveryServiceClient client) :
     base(receiver)
 {
     this.receiver = receiver;
     this.service  = service;
     this.client   = client;
 }
Exemple #10
0
        /// <summary>
        /// 获取组织机构权限域数据
        /// </summary>
        public DataTable GetOrganizeScope(string permissionItemScopeCode, bool isInnerOrganize)
        {
            // 获取部门数据,不启用权限域
            DataTable dataTable = new DataTable(BaseOrganizeEntity.TableName);

            if ((UserInfo.IsAdministrator) || (String.IsNullOrEmpty(permissionItemScopeCode) || (!BaseSystemInfo.UsePermissionScope)))
            {
                dataTable = ClientCache.Instance.GetOrganizeDT(UserInfo).Copy();
                if (isInnerOrganize)
                {
                    BaseBusinessLogic.SetFilter(dataTable, BaseOrganizeEntity.FieldIsInnerOrganize, "1");
                    BaseInterfaceLogic.CheckTreeParentId(dataTable, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId);
                }
                dataTable.DefaultView.Sort = BaseOrganizeEntity.FieldSortCode;
            }
            else
            {
                DotNetService dotNetService = new DotNetService();
                dataTable = dotNetService.PermissionService.GetOrganizeDTByPermissionScope(UserInfo, UserInfo.Id, permissionItemScopeCode);
                if (dotNetService.PermissionService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.PermissionService).Close();
                }
                if (isInnerOrganize)
                {
                    BaseBusinessLogic.SetFilter(dataTable, BaseOrganizeEntity.FieldIsInnerOrganize, "1");
                    BaseInterfaceLogic.CheckTreeParentId(dataTable, BaseOrganizeEntity.FieldId, BaseOrganizeEntity.FieldParentId);
                }
                dataTable.DefaultView.Sort = BaseOrganizeEntity.FieldSortCode;
            }
            return(dataTable);
        }
Exemple #11
0
        /// <summary>
        /// 获取模块菜单限域数据
        /// </summary>
        public DataTable GetModuleScope(string permissionItemScopeCode)
        {
            DotNetService dotNetService = new DotNetService();

            // 获取部门数据
            if ((UserInfo.IsAdministrator) || (String.IsNullOrEmpty(permissionItemScopeCode)))
            {
                DataTable dtModule = dotNetService.ModuleService.GetDataTable(UserInfo);
                if (dotNetService.ModuleService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.ModuleService).Close();
                }
                // 这里需要只把有效的模块显示出来
                // BaseBusinessLogic.SetFilter(dtModule, BaseModuleEntity.FieldEnabled, "1");
                // 未被打上删除标标志的
                // BaseBusinessLogic.SetFilter(dtModule, BaseModuleEntity.FieldDeletionStateCode, "0");
                return(dtModule);
            }
            else
            {
                DataTable dataTable = dotNetService.PermissionService.GetModuleDTByPermissionScope(UserInfo, UserInfo.Id, permissionItemScopeCode);
                if (dotNetService.PermissionService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.PermissionService).Close();
                }
                BaseInterfaceLogic.CheckTreeParentId(dataTable, BaseModuleEntity.FieldId, BaseModuleEntity.FieldParentId);
                return(dataTable);
            }
        }
Exemple #12
0
        /// <summary>
        /// 获取用户权限域数据
        /// </summary>
        public DataTable GetUserScope(string permissionItemScopeCode)
        {
            // 是否有用户管理权限,若有用户管理权限就有所有的用户类表,这个应该是内置的操作权限
            bool userAdmin = false;

            userAdmin = this.IsAuthorized("UserAdmin");
            DataTable returnValue = new DataTable(BaseUserEntity.TableName);
            // 获取用户数据
            DotNetService dotNetService = new DotNetService();

            if (userAdmin)
            {
                if (this.UserInfo.IsAdministrator || (String.IsNullOrEmpty(permissionItemScopeCode)))
                {
                    returnValue = dotNetService.UserService.GetDataTable(UserInfo);
                    if (dotNetService.UserService is ICommunicationObject)
                    {
                        ((ICommunicationObject)dotNetService.UserService).Close();
                    }
                }
                else
                {
                    returnValue = dotNetService.PermissionService.GetUserDTByPermissionScope(UserInfo, UserInfo.Id, permissionItemScopeCode);
                    if (dotNetService.PermissionService is ICommunicationObject)
                    {
                        ((ICommunicationObject)dotNetService.PermissionService).Close();
                    }
                }
            }
            return(returnValue);
        }
Exemple #13
0
        /// <summary>
        /// 设置控件状态
        /// </summary>
        public override void SetControlState()
        {
            if (!this.ReceiverId.Equals(this.UserInfo.Id))
            {
                this.btnSend.Enabled = (!string.IsNullOrEmpty(this.ReceiverId) && (this.txtContent.Text.Length > 0));
            }
            DotNetService  dotNetService = new DotNetService();
            BaseUserEntity userEntity    = dotNetService.UserService.GetEntity(this.UserInfo, this.ReceiverId);

            this.Text = userEntity.RealName + " (" + userEntity.DepartmentName + ")";
        }
Exemple #14
0
        /// <summary>
        /// 从数据库中读取文件
        /// </summary>
        /// <param name="id">文件主键</param>
        /// <returns>文件</returns>
        public byte[] Download(string id)
        {
            DotNetService dotNetService = new DotNetService();

            byte[] returnValue = dotNetService.FileService.Download(UserInfo, id);
            if (dotNetService.FileService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.FileService).Close();
            }
            return(returnValue);
        }
Exemple #15
0
 /// <summary>
 /// 获得权限缓存数据
 /// </summary>
 /// <param name="userInfo">当前用户</param>
 /// <returns>数据表</returns>
 public DataTable GetPermission(BaseUserInfo userInfo)
 {
     if ((this.dtPermission == null) || (!BaseSystemInfo.ClientCache))
     {
         DotNetService dotNetService = new DotNetService();
         this.dtPermission = dotNetService.PermissionService.GetPermissionDT(userInfo);
         if (dotNetService.PermissionService is ICommunicationObject)
         {
             ((ICommunicationObject)dotNetService.PermissionService).Close();
         }
     }
     return(this.dtPermission);
 }
        /// <summary>
        /// 批量删除
        /// </summary>
        public override int BatchDelete()
        {
            DotNetService dotNetService = new DotNetService();
            int           returnValue   = dotNetService.ExceptionService.BatchDelete(this.UserInfo, this.GetSelecteIds());

            if (dotNetService.ExceptionService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.ExceptionService).Close();
            }
            // 绑定数据
            this.GetList();
            return(returnValue);
        }
Exemple #17
0
 /// <summary>
 /// 获得部门缓存数据
 /// </summary>
 /// <param name="userInfo">当前用户</param>
 /// <returns>部门数据表</returns>
 public DataTable GetOrganizeDT(BaseUserInfo userInfo)
 {
     if ((this.dtOrganize == null) || (!BaseSystemInfo.ClientCache))
     {
         DotNetService dotNetService = new DotNetService();
         this.dtOrganize = dotNetService.OrganizeService.GetDataTable(userInfo);
         if (dotNetService.OrganizeService is ICommunicationObject)
         {
             ((ICommunicationObject)dotNetService.OrganizeService).Close();
         }
     }
     this.dtOrganize.DefaultView.Sort = BaseOrganizeEntity.FieldSortCode;
     return(this.dtOrganize);
 }
Exemple #18
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <returns>是否成功</returns>
        private bool LogOn(bool prompt)
        {
            // 设置鼠标繁忙状态,并保留原先的状态
            Cursor holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            string statusCode    = string.Empty;
            string statusMessage = string.Empty;

            try
            {
                string        userName      = BaseSystemInfo.CurrentUserName;
                DotNetService dotNetService = new DotNetService();
                BaseUserInfo  userInfo      = dotNetService.LogOnService.UserLogOn(UserInfo, userName, this.txtPassword.Text, false, out statusCode, out statusMessage);
                if (dotNetService.LogOnService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.LogOnService).Close();
                }
                if (statusCode == StatusCode.OK.ToString())
                {
                    this.LogOned            = true;
                    BaseSystemInfo.UserInfo = userInfo;
                    return(true);
                }
                else
                {
                    // 是否进行消息提示
                    if (prompt)
                    {
                        // MessageBox.Show(statusMessage, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        // "密码错误,请注意大小写。"
                        MessageBox.Show(AppMessage.MSG9967, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    this.txtPassword.Focus();
                    this.txtPassword.SelectAll();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                this.ProcessException(ex);
            }
            finally
            {
                // 已经忙完了
                this.Cursor = holdCursor;
            }
            return(true);
        }
Exemple #19
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            StringBuilder sbmy = new StringBuilder();

            sbmy.Append("<div style='margin:2px;padding:0px 0px 0px 15px;" +
                        "font-family:" + this.txtContents.Font.FontFamily.Name + ";" +
                        "font-size:" +
                        this.txtContents.Font.Size + "pt;color:#" +
                        this.txtContents.ForeColor.R.ToString("X2") +
                        this.txtContents.ForeColor.G.ToString("X2") +
                        this.txtContents.ForeColor.B.ToString("X2"));
            sbmy.Append(";font-weight:");
            sbmy.Append(this.txtContents.Font.Bold ? "bold" : "");
            sbmy.Append(";font-style:");
            sbmy.Append(this.txtContents.Font.Italic ? "italic" : "");
            sbmy.Append(";'>");
            sbmy.Append(GetHtmlHref(this.txtContents.Text) + "</div>");

            DotNetService dotNetService = new DotNetService();

            if (this.ucUser.SelectedIds != null)
            {
                // 发送信息
                BaseMessageEntity messageEntity = new BaseMessageEntity();
                messageEntity.Id                = BaseBusinessLogic.NewGuid();
                messageEntity.FunctionCode      = MessageFunction.Message.ToString();
                messageEntity.Contents          = sbmy.ToString();
                messageEntity.IsNew             = 1;
                messageEntity.ReadCount         = 0;
                messageEntity.Enabled           = 1;
                messageEntity.DeletionStateCode = 0;
                dotNetService.MessageService.BatchSend(UserInfo, this.ucUser.SelectedIds, null, null, messageEntity);
            }
            else
            {
                if (this.ucUser.SelectedId != null)
                {
                    dotNetService.MessageService.Send(UserInfo, this.ucUser.SelectedId, sbmy.ToString());
                }
            }
            if (dotNetService.MessageService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.MessageService).Close();
            }
            // 2010-12-15 发好信息了,还是关闭了比较好
            // this.txtContent.Clear();
            // this.txtContent.Focus();
            this.Close();
        }
        public async Task <IActionResult> restore(string name)
        {
            var getWebsite = await this.discoveryServiceClient.GetWebsite(name);

            if (name == null)
            {
                return(this.NotFound());
            }

            var result = await DotNetService.RestoreDotnetPackages(getWebsite.Path);

            var message = string.Join("\n", result.Select(p => (p.IsError ? "[ERROR]: " : "[Message]: ") + p.Message));

            return(this.Ok(message));
        }
Exemple #21
0
        /// <summary>
        /// 保存页面个性化配置情况
        /// </summary>
        private void SaveConfiguration()
        {
            DotNetService dotNetService = new DotNetService();

            dotNetService.ParameterService.SetParameter(UserInfo, "User", UserInfo.Id, "IsLockSystem", ckbIsLock.Checked.ToString());

            if (this.cmbLockWaitMinute.SelectedValue != null)
            {
                dotNetService.ParameterService.SetParameter(UserInfo, "User", UserInfo.Id, "LockWaitMinute", this.cmbLockWaitMinute.SelectedValue.ToString());
            }
            if (dotNetService.ParameterService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.ParameterService).Close();
            }
        }
Exemple #22
0
        private void Search(string organizeId)
        {
            int           recordCount   = 0;
            DotNetService dotNetService = new DotNetService();

            // 获取数据
            this.DTStaff = dotNetService.StaffService.GetAddressDataTableByPage(UserInfo, organizeId, this.txtSearch.Text, pager.PageSize, pager.PageIndex, out recordCount);
            if (dotNetService.StaffService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.StaffService).Close();
            }
            pager.RecordCount = recordCount;
            pager.InitPageInfo();
            // 绑定屏幕数据
            this.BindData();
        }
Exemple #23
0
 private void FrmMessageRead_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] file = (string[])e.Data.GetData(DataFormats.FileDrop);
         // 设置鼠标繁忙状态,并保留原先的状态
         Cursor holdCursor = this.Cursor;
         this.Cursor = Cursors.WaitCursor;
         try
         {
             DotNetService dotNetService = new DotNetService();
             for (int i = 0; i <= file.Length - 1; i++)
             {
                 if (System.IO.File.Exists(file[i]))
                 {
                     byte[] fileContents = FileUtil.GetFile(file[i]);
                     string fileName     = System.IO.Path.GetFileName(file[i]);
                     dotNetService.FileService.Send(UserInfo, fileName, fileContents, this.ReceiverId);
                     // this.Text = this.webBMsg.DocumentText.Length.ToString();
                     string message = "发送文件 " + fileName + " 成功,等待对方接收。";
                     if (this.webMessage.DocumentText.Length > 216)
                     {
                         message = "<br>" + message;
                     }
                     this.webMessage.DocumentText = this.webMessage.DocumentText.Insert(this.webMessage.DocumentText.Length, message);
                 }
             }
             if (dotNetService.MessageService is ICommunicationObject)
             {
                 ((ICommunicationObject)dotNetService.MessageService).Close();
             }
         }
         catch (Exception ex)
         {
             this.ProcessException(ex);
         }
         finally
         {
             // 设置鼠标默认状态,原来的光标状态
             this.Cursor = holdCursor;
         }
     }
 }
Exemple #24
0
        private void mitmOnLine_Click(object sender, EventArgs e)
        {
            // 1.修改用户在线状态
            DotNetService dotNetService = new DotNetService();
            int           onLineState   = int.Parse(((ToolStripMenuItem)sender).Tag.ToString());

            dotNetService.LogOnService.OnLine(UserInfo, onLineState);
            if (dotNetService.LogOnService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.LogOnService).Close();
            }
            BaseSystemInfo.OnLineState = onLineState;
            // 2.修改按钮状态
            this.mitmOnLine1.Enabled            = true;
            this.mitmOnLine2.Enabled            = true;
            this.mitmOnLine3.Enabled            = true;
            this.mitmOnLine4.Enabled            = true;
            this.mitmOnLine5.Enabled            = true;
            ((ToolStripMenuItem)sender).Enabled = false;
        }
Exemple #25
0
        /// <summary>
        /// 获取用户权限
        /// </summary>
        /// <param name="userInfo">当前用户</param>
        public void GetUserPermission(BaseUserInfo userInfo)
        {
            // 获取模块列表
            DotNetService dotNetService = new DotNetService();

            ClientCache.Instance.DTMoule = dotNetService.ModuleService.GetDataTable(userInfo);
            if (dotNetService.ModuleService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.ModuleService).Close();
            }
            // 获取用户模块访问权限范围
            ClientCache.Instance.DTUserMoule = dotNetService.PermissionService.GetModuleDTByUser(userInfo, userInfo.Id);
            if (dotNetService.PermissionService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.PermissionService).Close();
            }
            // 获取用户的操作权限
            ClientCache.Instance.DTPermission = null;
            ClientCache.Instance.GetPermission(userInfo);
        }
        /// <summary>
        /// 绑定屏幕数据
        /// </summary>
        public override void GetList()
        {
            // 权限信息
            DotNetService dotNetService = new DotNetService();

            this.DTException = dotNetService.ExceptionService.GetDataTable(UserInfo);
            if (dotNetService.ExceptionService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.ExceptionService).Close();
            }
            this.grdExceptionAdmin.AutoGenerateColumns = false;

            // 2012.05.23 Pcsky 按创建时间倒序排列,方便查看最新的异常
            this.DTException.DefaultView.Sort = BaseExceptionEntity.FieldCreateOn + " DESC";
            this.grdExceptionAdmin.DataSource = this.DTException.DefaultView;
            this.grdExceptionAdmin.Refresh();

            // 设置按钮状态
            this.SetControlState();
        }
Exemple #27
0
        /// <summary>
        /// 置底
        /// </summary>
        /// <returns>影响行数</returns>
        public int SetBottom()
        {
            RowCount = RowIndex;
            int    returnValue = 0;
            string targetId    = "";

            if (dataTableFlag)
            {
                targetId = BaseSortLogic.GetNextId(this.dataView, this.EntityId);
            }
            else
            {
                targetId = BaseSortLogic.GetNextIdDyn(this.lstT, this.EntityId);
            }
            if (targetId.Length > 0)
            {
                DotNetService dotNetService = new DotNetService();
                string        sequence      = dotNetService.SequenceService.GetSequence(UserInfo, dataTableFlag ? this.dataView.Table.TableName : tabelName);
                if (dotNetService.SequenceService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.SequenceService).Close();
                }
                if (dataTableFlag)
                {
                    returnValue = BaseBusinessLogic.SetProperty(this.dataView.Table, this.EntityId, BaseBusinessLogic.FieldSortCode, sequence);
                }
                else
                {
                    returnValue = BaseBusinessLogic.SetPropertyDyn(this.lstT, this.EntityId, BaseBusinessLogic.FieldSortCode, sequence);
                    SetCRow();
                }
            }
            else
            {
                if (BaseSystemInfo.ShowInformation)
                {
                    MessageBox.Show(AppMessage.MSG0022, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return(returnValue);
        }
Exemple #28
0
 /// <summary>
 /// 关闭窗体
 /// </summary>
 private void FormOnClosed()
 {
     if (!this.DesignMode)
     {
         // 是否记录访问日志,已经登录了系统了,才记录日志
         if (BaseSystemInfo.RecordLog && BaseSystemInfo.UserIsLogOn)
         {
             // 保存列宽
             BaseInterfaceLogic.SaveDataGridViewColumnWidth(this);
             // 调用服务事件
             if (this.RecordFormLog)
             {
                 DotNetService dotNetService = new DotNetService();
                 dotNetService.LogService.WriteExit(UserInfo, this.LogId);
                 if (dotNetService.LogService is ICommunicationObject)
                 {
                     ((ICommunicationObject)dotNetService.LogService).Close();
                 }
             }
         }
     }
 }
Exemple #29
0
        /// <summary>
        /// 加载窗体
        /// </summary>
        public override void FormOnLoad()
        {
            // 这里是按员工登录
            // this.DTUser = DotNetService.Instance.LogOnService.GetStaffDT(UserInfo);
            // 这里是按用户登录
            DotNetService dotNetService = new DotNetService();

            this.DTUser = dotNetService.LogOnService.GetUserDT(UserInfo);
            if (dotNetService.LogOnService is ICommunicationObject)
            {
                ((ICommunicationObject)dotNetService.LogOnService).Close();
            }

            // 员工需要按用户名排序问题解决
            // this.DTUser.DefaultView.Sort = BaseUserEntity.FieldSortCode;
            // 解决用户名密码记不住的问题
            // foreach (DataRowView dataRowView in this.DTUser.DefaultView)
            // {
            //     this.cmbUser.Items.Add(dataRowView[BaseUserEntity.FieldUserName].ToString());
            // }
            // 显示用户真实姓名,保存用户名
            this.cmbUser.DataSource    = this.DTUser.DefaultView;
            this.cmbUser.DisplayMember = BaseUserEntity.FieldRealName;
            this.cmbUser.ValueMember   = BaseUserEntity.FieldUserName;

            // 保存密码
            this.chkRememberPassword.Checked = BaseSystemInfo.RememberPassword;
            // 获取现有的登录信息
            this.GetLogOnInfo();
            // 默认焦点在用户名输入上
            this.cmbUser.Focus();

            // 当前的输入焦点停留在密码编辑框上,呵呵不错的改进。
            if (this.cmbUser.Text.Length > 0)
            {
                this.ActiveControl = this.txtPassword;
                this.txtPassword.Focus();
            }
        }
Exemple #30
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            /*
             * if (!this.ExitApplication)
             * {
             *  e.Cancel = true;
             *  this.Hide();
             * }
             * else
             * {
             */

            if (BaseSystemInfo.UserIsLogOn)
            {
                /*
                 * 简化一下,退出时没必要问是否退出了省事一些。
                 #if (!DEBUG)
                 *  if (MessageBox.Show(AppMessage.MSG0204, AppMessage.MSG0000, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                 *  {
                 *      e.Cancel = true;
                 *      return;
                 *  }
                 #endif
                 */

                if (Program.frmMessage != null)
                {
                    Program.frmMessage.ExitApplication = true;
                    Program.frmMessage.Dispose();
                }
                // 退出应用程序
                DotNetService dotNetService = new DotNetService();
                dotNetService.LogOnService.OnExit(UserInfo);
                if (dotNetService.LogOnService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.LogOnService).Close();
                }
            }
        }