コード例 #1
0
        public static bool CheckProject(string softwareName)
        {
            Model.UserProjectModel curProject = null;
            Model.UserModel        user       = Bll.SystemBll.UserInfo;
            if (user == null || user.Projects == null || user.Projects.Count == 0)
            {
                MessageBox.Show("账号信息不正确,请联系管理员处理!");
                return(false);
            }

            foreach (var item in user.Projects)
            {
                if (item.MonitoringSoftwareName == softwareName)
                {
                    curProject = item;
                    break;
                }
            }

            if (curProject == null)
            {
                //MessageBox.Show("工程信息绑定不正确,请联系管理员处理!");
                return(false);
            }
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (userProject == null)
            {
                userProject = new Model.UserProjectModel();
            }

            int    isLock                 = this.skinRadioButton_lock.Checked ? 1 : 0;;
            string projectName            = this.skinTextBox_projectName.SkinTxt.Text;
            string monitoringPath         = this.skinTextBox_monitoringPath.SkinTxt.Text;
            string monitoringSoftwareName = this.skinTextBox_monitoringSoftwareName.SkinTxt.Text;
            string addTimeStr             = this.skinTextBox_addTime.SkinTxt.Text.Trim();

            DateTime addTime = DateTime.Now;

            if (string.IsNullOrEmpty(projectName))
            {
                MessageBoxEx.Show("工程信息不能为空!");
                return;
            }

            if (string.IsNullOrEmpty(monitoringPath))
            {
                MessageBoxEx.Show("工程路径不能为空!");
                return;
            }

            if (string.IsNullOrEmpty(monitoringSoftwareName))
            {
                MessageBoxEx.Show("监控软件名称不能为空!");
                return;
            }

            if (string.IsNullOrEmpty(addTimeStr) || !DateTime.TryParse(addTimeStr, out addTime))
            {
                MessageBoxEx.Show("添加时间不正确!");
                return;
            }

            userProject.IsLock                 = isLock;
            userProject.ProjectName            = projectName;
            userProject.MonitoringPath         = monitoringPath;
            userProject.MonitoringSoftwareName = monitoringSoftwareName;
            userProject.AddTime                = addTime;
            FrmUserEdit userForm = (FrmUserEdit)this.Owner;

            userForm.modifyOrAddItem = userProject;

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
コード例 #3
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_ok_Click(object sender, EventArgs e)
        {
            Model.UserModel user       = new Model.UserModel();
            BLL.ManagerBll  managerBll = new BLL.ManagerBll();

            try
            {
                #region 信息校验

                //校验
                int    isLock     = this.skinRadioButton_lock.Checked ? 1 : 0;;
                string userName   = this.skinTextBox_userName.SkinTxt.Text;
                string realName   = this.skinTextBox_realName.SkinTxt.Text;
                int    roleType   = this.skinComboBox_role.SelectedIndex;
                string addTimeStr = this.skinTextBox_addTime.SkinTxt.Text.Trim();

                DateTime addTime = DateTime.Now;
                if (string.IsNullOrEmpty(userName))
                {
                    MessageBoxEx.Show("账号不能为空!");
                    return;
                }

                if (string.IsNullOrEmpty(realName))
                {
                    MessageBoxEx.Show("姓名不能为空!");
                    return;
                }

                if (roleType != 0 && roleType != 1)
                {
                    MessageBoxEx.Show("请联系管理员,用户角色有异常!");
                    return;
                }

                if (string.IsNullOrEmpty(addTimeStr) || !DateTime.TryParse(addTimeStr, out addTime))
                {
                    MessageBoxEx.Show("添加时间不正确!");
                    return;
                }

                //新增用户校验用户是否存在
                if (userId <= 0)
                {
                    bool isExidted = managerBll.Exists(userName);
                    if (isExidted)
                    {
                        MessageBoxEx.Show(string.Format("账号: {0}已经存在!", userName));
                        return;
                    }
                    //开始修改值
                }

                //修改用户
                if (userId > 0)
                {
                    user = managerBll.GetModel(userId);
                    //开始修改值
                }

                #endregion

                #region  构建信息
                user.IsLock   = isLock;
                user.UserName = userName;
                user.RealName = realName;
                user.RoleType = roleType;
                user.RoleName = this.skinComboBox_role.SelectedItem.ToString();;
                user.AddTime  = addTime;

                //工程信息构建
                user.Projects = new List <Model.UserProjectModel>();
                foreach (DataGridViewRow item in this.skinDataGridView_projects.Rows)
                {
                    Model.UserProjectModel projectModel = (Model.UserProjectModel)item.Tag;
                    if (projectModel == null)
                    {
                        continue;
                    }
                    user.Projects.Add(projectModel);
                }

                #endregion

                #region 添加域账号判断
                // 域账号验证
                if (!AuthDomin(realName, userName))
                {
                    return;
                }
                #endregion

                //修改用户
                if (userId > 0)
                {
                    if (managerBll.Update(user))
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    }
                    else
                    {
                        MessageBoxEx.Show("更新用户信息异常!");
                    }
                }
                else
                {
                    if (managerBll.Add(user) > 0)
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    }
                    else
                    {
                        MessageBoxEx.Show("新增用户信息异常!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("更新用户信息异常!" + ex.Message);
            }
        }
コード例 #4
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                Model.UserProjectModel curProject = null;
                Model.UserModel        user       = Bll.SystemBll.UserInfo;
                if (user == null || user.Projects == null || user.Projects.Count == 0)
                {
                    MessageBox.Show("账号信息不正确,请联系管理员处理!");
                    return;
                }

                foreach (var item in user.Projects)
                {
                    if (item.MonitoringSoftwareName == softwareName)
                    {
                        curProject = item;
                        break;
                    }
                }

                if (curProject == null)
                {
                    MessageBox.Show("工程信息绑定不正确,请联系管理员处理!");
                    return;
                    //curProject = user.Projects[0];
                }

                if (curProject == null || string.IsNullOrEmpty(curProject.MonitoringPath))
                {
                    MessageBox.Show("服务器配置路径不正确,请联系管理员处理!");
                    return;
                }

                //监控绑定路径
                string dirPath = curProject.MonitoringPath;
                if (!Directory.Exists(dirPath))
                {
                    MessageBox.Show("服务器配置路径不正确,请联系管理员处理!");
                    return;
                }

                //此处查询出所有文件内容
                DirectoryInfo  rootDirInfo = new DirectoryInfo(dirPath);
                FileWinexploer upload      = new FileWinexploer();

                //上传之前开启文件受影响检查
                user.CurProject = curProject;
                this.curProject = curProject;

                #region 20151104修改上传动画效果&初次上传大量文件卡死现象--删除
                //upload.CheckFolderUploadToDb(dirPath, user);
                //if (FileWinexploer.NeedAddOrMordifyFiles == null || FileWinexploer.NeedAddOrMordifyFiles.Count == 0)
                //{
                //    MessageBox.Show("没有可更新文件,不需要操作!");
                //    return;
                //}
                //else
                //{
                //    if (MessageBox.Show(
                //     string.Format("此次上传文件数量为:{0},是否继续上传!", FileWinexploer.NeedAddOrMordifyFiles.Count),
                //      "一键上传文件",
                //       MessageBoxButtons.OKCancel) == DialogResult.OK)
                //    {
                //        //检查通过开始异步上传
                //        FolderUploadHandler handler = new FolderUploadHandler(upload.FolderUploadToDb);
                //        handler.BeginInvoke(dirPath, user, IAsyncMenthod, null);

                //        ///异步日志
                //        ActionLog(string.Empty, ActionType.ALLUPLOAD);

                //        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                //        return;

                //        //动态上传进度
                //        FrmFileTransferNew frmTransfer = new FrmFileTransferNew(0);
                //        frmTransfer.Show();
                //    }
                //}
                #endregion

                #region 20151104修改上传动画效果&初次上传大量文件卡死现象--修改

                // 提示是否上传|取消|上传差异
                string        tip        = FileWinexploer.ConstructUploadTip();
                FrmMessageBox messageBox = new FrmMessageBox(tip, 0);
                var           result     = messageBox.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                // 替换检查界面[8.5wjh]
                FrmWait      frmCheckFile       = new FrmWait(dirPath, user, 0);
                DialogResult frmCheckFileResult = frmCheckFile.ShowDialog();
                if (frmCheckFileResult != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                if (FileWinexploer.NeedAddOrMordifyFiles == null || FileWinexploer.NeedAddOrMordifyFiles.Count == 0)
                {
                    MessageBox.Show("上传完成!");
                    return;
                }
                else
                {
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        FileWinexploer.SetUploadCache();
                    }

                    // 0909 上传王君海修改
                    //FrmFileProgressBar frmTransfer = new FrmFileProgressBar(0);

                    //检查通过开始异步上传
                    FolderUploadHandler handler = new FolderUploadHandler(upload.FolderUploadToDb);
                    handler.BeginInvoke(dirPath, user, IAsyncMenthod, null);

                    ///异步日志
                    ActionLog(string.Empty, ActionType.ALLUPLOAD);

                    //frmTransfer.Activate();
                    //frmTransfer.Show();
                }
                #endregion

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
コード例 #5
0
 public FrmUserProject(Model.UserProjectModel userProject)
 {
     InitializeComponent();
     this.userProject = userProject;
     InitUiData();
 }