示例#1
0
        private void SingleSchedulingForm_Load(object sender, EventArgs e)
        {
            MainForm = (Form)this.Parent;
            dateEdit1.Properties.MinValue = DateTime.Now;
            dateEdit1.Properties.MaxValue = DateTime.Now.AddDays(90);

            cmd = new Xr.Common.Controls.OpaqueCommand(AppContext.Session.waitControl);
            cmd.ShowOpaqueLayer(0f);
            //设置科室列表
            //String param = "hospital.code=" + AppContext.AppConfig.hospitalCode + "&code=" + AppContext.AppConfig.deptCode;
            //String url = AppContext.AppConfig.serverUrl + "cms/dept/findAll?" + param;
            //this.DoWorkAsync( 0, (o) =>
            //{
            //    String data = HttpClass.httpPost(url);
            //    return data;

            //}, null, (data) =>
            //{
            //    JObject objT = JObject.Parse(data.ToString());
            //    if (string.Compare(objT["state"].ToString(), "true", true) == 0)
            //    {
            //List<DeptEntity> deptList = objT["result"].ToObject<List<DeptEntity>>();
            List <DeptEntity> deptList = AppContext.Session.deptList;

            treeMenuControl1.KeyFieldName    = "id";
            treeMenuControl1.ParentFieldName = "parentId";
            treeMenuControl1.DisplayMember   = "name";
            treeMenuControl1.ValueMember     = "id";
            treeMenuControl1.DataSource      = deptList;

            //查询状态下拉框数据
            String url = AppContext.AppConfig.serverUrl + "sys/sysDict/findByType?type=is_use";

            this.DoWorkAsync(0, (o) =>          //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
            {
                String data = HttpClass.httpPost(url);
                return(data);
            }, null, (data2) =>         //显示结果(此处用于对上面结果的处理,比如显示到界面上)
            {
                JObject objT = JObject.Parse(data2.ToString());
                if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                {
                    List <DictEntity> dictList        = objT["result"].ToObject <List <DictEntity> >();
                    lueIsUse.Properties.DataSource    = dictList;
                    lueIsUse.Properties.DisplayMember = "label";
                    lueIsUse.Properties.ValueMember   = "value";
                    lueIsUse.EditValue = dictList[0].value;
                    cmd.HideOpaqueLayer();
                }
                else
                {
                    cmd.HideOpaqueLayer();
                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                    return;
                }
            });
            //    }
            //    else
            //    {
            //        cmd.HideOpaqueLayer();
            //        MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
            //        return;
            //    }
            //});
        }
示例#2
0
        private void UserEdit_Load(object sender, EventArgs e)
        {
            labelControl1.Font      = new Font("微软雅黑", 18, FontStyle.Regular, GraphicsUnit.Pixel);
            labelControl1.ForeColor = Color.FromArgb(255, 0, 0);
            labelControl2.Font      = new Font("微软雅黑", 18, FontStyle.Regular, GraphicsUnit.Pixel);
            labelControl2.ForeColor = Color.FromArgb(255, 0, 0);
            labelControl3.Font      = new Font("微软雅黑", 18, FontStyle.Regular, GraphicsUnit.Pixel);
            labelControl3.ForeColor = Color.FromArgb(255, 0, 0);
            cmd = new Xr.Common.Controls.OpaqueCommand(this);
            cmd.ShowOpaqueLayer(0f);
            richEditor1.ImagUploadUrl = AppContext.AppConfig.serverUrl;
            dcUser.DataType           = typeof(UserEntity);
            richEditor1.ImagUploadUrl = AppContext.AppConfig.serverUrl;

            //获取科室数据
            String url = AppContext.AppConfig.serverUrl + "cms/dept/findAll?hospital.code=" + AppContext.AppConfig.hospitalCode;

            this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
            {
                String data = HttpClass.httpPost(url);
                return(data);
            }, null, (data2) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
            {
                JObject objT = JObject.Parse(data2.ToString());
                if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                {
                    List <DeptEntity> deptList = objT["result"].ToObject <List <DeptEntity> >();
                    //DeptEntity dept = new DeptEntity();
                    //dept.code = "`";
                    //dept.name = "全院";
                    //dept.id = "`";
                    //deptList.Insert(0, dept);
                    treeList1.DataSource                 = deptList;
                    treeList1.KeyFieldName               = "id";                 //设置ID  
                    treeList1.ParentFieldName            = "parentId";           //设置PreID  
                    treeList1.OptionsView.ShowCheckBoxes = true;                 //显示多选框
                    treeList1.OptionsBehavior.AllowRecursiveNodeChecking = true; //选中父节点,子节点也会全部选中
                    treeList1.OptionsBehavior.Editable = false;                  //数据不可编辑
                    treeList1.ExpandAll();                                       //展开所有节点
                    //treeDept.Properties.DataSource = deptList;
                    //treeDept.Properties.TreeList.KeyFieldName = "id";
                    //treeDept.Properties.TreeList.ParentFieldName = "parentId";
                    //treeDept.Properties.DisplayMember = "name";
                    //treeDept.Properties.ValueMember = "id";
                    ////treeDept.EditValue = "`";
                    ////这个应该是个选择多选框触发的事件
                    //treeDept.Properties.TreeList.AfterCheckNode += (s, a) =>
                    //{
                    //    a.Node.Selected = true;
                    //    GetSelectedRoleIDandName();
                    //};
                    List <RoleEntity> roleList = new List <RoleEntity>();
                    List <String> roleIdList   = new List <String>();
                    String type = "0";         //11:超级管理员  1:系统管理员 8:科室管理员 0:其他

                    this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
                    {
                        String data = HttpClass.httpPost(AppContext.AppConfig.serverUrl + "sys/sysRole/findAll");
                        return(data);
                    }, null, (data3) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
                    {
                        objT = JObject.Parse(data3.ToString());
                        if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                        {
                            //TODO:在这里进行判断,user是空的,会报错,后面再处理
                            roleList   = objT["result"].ToObject <List <RoleEntity> >();
                            roleIdList = AppContext.Session.roleIdList;
                            List <RoleEntity> showRoleList = new List <RoleEntity>();//显示的角色

                            //超级管理员只有一个 并且id为1,可以分配除超级管理员外的角色;
                            //系统管理员有多个,可以分配除超级\系统管理外的角色;
                            //科室管理员有多个,可以分配医生、护士两个角色;
                            foreach (String roleId in roleIdList)
                            {
                                if (roleId.Equals("11"))
                                {
                                    type = "11";
                                    break;
                                }
                                if (roleId.Equals("1"))
                                {
                                    type = "1";
                                    break;
                                }
                                if (roleId.Equals("8"))
                                {
                                    type = "8";
                                    break;
                                }
                            }
                            foreach (RoleEntity role in roleList)
                            {
                                if (type.Equals("11"))
                                {
                                    if (user == null)
                                    {
                                        if (!role.name.Equals("超级管理员") && !role.id.Equals("11"))
                                        {
                                            showRoleList.Add(role);
                                        }
                                    }
                                }
                                else if (type.Equals("1"))
                                {
                                    if (user == null)
                                    {
                                        if (!role.id.Equals("11") && !role.id.Equals("1"))
                                        {
                                            showRoleList.Add(role);
                                        }
                                    }
                                }
                                else if (type.Equals("8"))
                                {
                                    if (user == null)
                                    {
                                        if (role.id.Equals("9") || role.id.Equals("10"))
                                        {
                                            showRoleList.Add(role);
                                        }
                                    }
                                }
                                else
                                {
                                    //if (!role.id.Equals("11") && !role.id.Equals("1"))
                                    //    checkedListBoxControl1.Items.Add(role.id, role.name);
                                }
                            }
                            treeListRole.DataSource                 = showRoleList;
                            treeListRole.KeyFieldName               = "id";                 //设置ID  
                            treeListRole.ParentFieldName            = "parentId";           //设置PreID  
                            treeListRole.OptionsView.ShowCheckBoxes = true;                 //显示多选框
                            treeListRole.OptionsBehavior.AllowRecursiveNodeChecking = true; //选中父节点,子节点也会全部选中
                            treeListRole.OptionsBehavior.Editable = false;                  //数据不可编辑
                            treeListRole.ExpandAll();                                       //展开所有节点
                        }
                        else
                        {
                            cmd.HideOpaqueLayer();
                            MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                                 MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this);
                            return;
                        }

                        if (user != null)
                        {
                            this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
                            {
                                String data = HttpClass.httpPost(AppContext.AppConfig.serverUrl + "sys/sysUser/getUser?userId=" + user.id);
                                return(data);
                            }, null, (data4) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
                            {
                                cmd.HideOpaqueLayer();
                                List <RoleEntity> showRoleList = new List <RoleEntity>();//显示的角色
                                objT = JObject.Parse(data4.ToString());
                                if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                                {
                                    user = objT["result"].ToObject <UserEntity>();

                                    foreach (RoleEntity role in roleList)
                                    {
                                        if (type.Equals("11"))
                                        {
                                            if (user != null)
                                            {
                                                bool isAdd      = false;
                                                String[] idsArr = user.roleIds.Split(',');
                                                foreach (string roleId in idsArr)
                                                {
                                                    if (roleId.Equals("11"))
                                                    {
                                                        isAdd = true;
                                                        break;
                                                    }
                                                }
                                                if (!isAdd)
                                                {
                                                    if (!role.name.Equals("超级管理员") && !role.id.Equals("11"))
                                                    {
                                                        showRoleList.Add(role);
                                                    }
                                                }
                                                else
                                                {
                                                    showRoleList.Add(role);
                                                }
                                            }
                                        }
                                        else if (type.Equals("1"))
                                        {
                                            if (user != null)
                                            {
                                                bool isAdd      = false;
                                                String[] idsArr = user.roleIds.Split(',');
                                                foreach (string roleId in idsArr)
                                                {
                                                    if (roleId.Equals("1"))
                                                    {
                                                        isAdd = true;
                                                        break;
                                                    }
                                                }
                                                if (isAdd)
                                                {
                                                    if (!role.id.Equals("11"))
                                                    {
                                                        showRoleList.Add(role);
                                                    }
                                                }
                                                else
                                                {
                                                    if (!role.id.Equals("11") && !role.id.Equals("1"))
                                                    {
                                                        showRoleList.Add(role);
                                                    }
                                                }
                                            }
                                        }
                                        else if (type.Equals("8"))
                                        {
                                            if (user != null)
                                            {
                                                bool isAdd      = false;
                                                String[] idsArr = user.roleIds.Split(',');
                                                foreach (string roleId in idsArr)
                                                {
                                                    if (roleId.Equals("8"))
                                                    {
                                                        isAdd = true;
                                                        break;
                                                    }
                                                }
                                                if (isAdd)
                                                {
                                                    if (role.id.Equals("8") || role.id.Equals("9") || role.id.Equals("10"))
                                                    {
                                                        showRoleList.Add(role);
                                                    }
                                                }
                                                else
                                                {
                                                    if (role.id.Equals("9") || role.id.Equals("10"))
                                                    {
                                                        showRoleList.Add(role);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (role.id.Equals("9") || role.id.Equals("10"))
                                                {
                                                    showRoleList.Add(role);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (user != null)
                                            {
                                                foreach (String roleId in roleIdList)
                                                {
                                                    if (!roleId.Equals("11") && !roleId.Equals("1") && !roleId.Equals("8"))
                                                    {
                                                        if (role.id.Equals(roleId))
                                                        {
                                                            showRoleList.Add(role);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    dcUser.SetValue(user);
                                    treeListRole.DataSource = showRoleList;//显示角色列表
                                    //DefaultChecked(user.deptIds);//默认选择所属科室
                                    String[] deptArray = user.deptIds.Split(',');
                                    for (int i = 0; i < deptArray.Count(); i++)
                                    {
                                        SetMenuNodeChecked(treeList1, deptArray[i], treeList1.Nodes);
                                    }
                                    GetSelectedRoleIDandName();
                                    treeDept.RefreshEditValue();

                                    //修改的时候密码显示为空
                                    password        = user.password;
                                    tePassword.Text = "";
                                    oldLoginName    = user.loginName;
                                    //设置多选框选择
                                    String[] strArr = user.roleIds.Split(',');
                                    foreach (string str in strArr)
                                    {
                                        for (int i = 0; i < showRoleList.Count; i++)
                                        {
                                            if (str.Equals(showRoleList[i].id))
                                            {
                                                SetRoleNodeChecked(treeListRole, str, treeListRole.Nodes);
                                                break;
                                            }
                                        }
                                    }
                                    richEditor1.LoadText(user.remarks);

                                    //显示图片
                                    if (user.imgPath != null && user.imgPath.Length > 0)
                                    {
                                        try
                                        {
                                            WebClient web          = new WebClient();
                                            var bytes              = web.DownloadData(AppContext.AppConfig.serverIp + user.imgPath);
                                            this.pictureBox1.Image = Bitmap.FromStream(new MemoryStream(bytes));
                                        }
                                        catch (Exception ex)
                                        {
                                            Xr.Log4net.LogHelper.Error(ex.Message);
                                        }
                                    }
                                    //WebClient web = new WebClient();
                                    //var bytes = web.DownloadData("http://127.0.0.1:8080/dzkb/uploadFileDir/user_1/2018-12-19/asuo_Splash_0.jpg");
                                    //this.pictureBox1.Image = Bitmap.FromStream(new MemoryStream(bytes));
                                }
                                else
                                {
                                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                                         MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this);
                                }
                            });
                        }
                        else
                        {
                            user = new UserEntity();
                            cmd.HideOpaqueLayer();
                        }
                    });
                }
                else
                {
                    cmd.HideOpaqueLayer();
                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                         MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this);
                    return;
                }
            });
        }
示例#3
0
        private void DeptSettingsForm_Load(object sender, EventArgs e)
        {
            MainForm = (Form)this.Parent;
            pageControl1.MainForm = MainForm;
            cmd = new Xr.Common.Controls.OpaqueCommand(AppContext.Session.waitControl);
            cmd.ShowOpaqueLayer(0f);
            dcDeptInfo.DataType = typeof(DeptInfoEntity);
            //查询医院下拉框数据
            String url = AppContext.AppConfig.serverUrl + "cms/hospital/findAll";

            this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
            {
                String data = HttpClass.httpPost(url);
                return(data);
            }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
            {
                JObject objT = JObject.Parse(data.ToString());
                if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                {
                    lueHospital.Properties.DataSource    = objT["result"].ToObject <List <HospitalInfoEntity> >();
                    lueHospital.Properties.DisplayMember = "name";
                    lueHospital.Properties.ValueMember   = "id";

                    //查询宣传显示下拉框数据
                    url = AppContext.AppConfig.serverUrl + "sys/sysDict/findByType?type=show_hide";
                    this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
                    {
                        data = HttpClass.httpPost(url);
                        return(data);
                    }, null, (data2) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
                    {
                        objT = JObject.Parse(data2.ToString());
                        if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                        {
                            lueIsShow.Properties.DataSource    = objT["result"].ToObject <List <DictEntity> >();
                            lueIsShow.Properties.DisplayMember = "label";
                            lueIsShow.Properties.ValueMember   = "value";

                            //查询状态下拉框数据
                            url = AppContext.AppConfig.serverUrl + "sys/sysDict/findByType?type=is_use";
                            this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
                            {
                                data = HttpClass.httpPost(url);
                                return(data);
                            }, null, (data3) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
                            {
                                objT = JObject.Parse(data3.ToString());
                                if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                                {
                                    lueIsUse.Properties.DataSource    = objT["result"].ToObject <List <DictEntity> >();
                                    lueIsUse.Properties.DisplayMember = "label";
                                    lueIsUse.Properties.ValueMember   = "value";

                                    SearchData(1, 10000);
                                }
                                else
                                {
                                    cmd.HideOpaqueLayer();
                                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                                         MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                                    return;
                                }
                            });
                        }
                        else
                        {
                            cmd.HideOpaqueLayer();
                            MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                                 MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                            return;
                        }
                    });
                }
                else
                {
                    cmd.HideOpaqueLayer();
                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                         MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                    return;
                }
            });
        }
        private void HospitalSettingsForm_Load(object sender, EventArgs e)
        {
            //labelControl1.Font = new Font("微软雅黑", 18, FontStyle.Regular, GraphicsUnit.Pixel);
            //labelControl1.ForeColor = Color.FromArgb(255, 0, 0);
            MainForm = (Form)this.Parent;
            pageControl1.MainForm = MainForm;
            cmd = new Xr.Common.Controls.OpaqueCommand(AppContext.Session.waitControl);
            cmd.ShowOpaqueLayer(0f);
            dcHospitalInfo.DataType = typeof(HospitalInfoEntity);
            pageControl1.PageSize   = Convert.ToInt32(AppContext.AppConfig.pagesize);

            bool scFlag = false;

            foreach (FunctionEntity function in AppContext.Session.functionList)
            {
                if (function.name.Equals("医院设置删除功能"))
                {
                    scFlag = true;
                    break;
                }
            }
            btnDel.Visible = scFlag;

            //查询医院类型下拉框数据
            String url = AppContext.AppConfig.serverUrl + "sys/sysDict/findByType?type=hospital_type";

            this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
            {
                String data = HttpClass.httpPost(url);
                return(data);
            }, null, (r) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
            {
                JObject objT = JObject.Parse(r.ToString());
                if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                {
                    lueHospitalType.Properties.DataSource    = objT["result"].ToObject <List <DictEntity> >();
                    lueHospitalType.Properties.DisplayMember = "label";
                    lueHospitalType.Properties.ValueMember   = "value";

                    //查询状态下拉框数据
                    String url2 = AppContext.AppConfig.serverUrl + "sys/sysDict/findByType?type=is_use";
                    this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
                    {
                        String data = HttpClass.httpPost(url2);
                        return(data);
                    }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
                    {
                        objT = JObject.Parse(data.ToString());
                        if (string.Compare(objT["state"].ToString(), "true", true) == 0)
                        {
                            lueIsUse.Properties.DataSource    = objT["result"].ToObject <List <DictEntity> >();
                            lueIsUse.Properties.DisplayMember = "label";
                            lueIsUse.Properties.ValueMember   = "value";

                            SearchData(1, pageControl1.PageSize);
                        }
                        else
                        {
                            cmd.HideOpaqueLayer();
                            MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                            return;
                        }
                    });
                }
                else
                {
                    cmd.HideOpaqueLayer();
                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                    return;
                }
            });
        }