private void lueHospital_EditValueChanged(object sender, EventArgs e)
        {
            if (lueHospital.EditValue == null || lueHospital.EditValue.ToString().Length == 0)
            {
                treeParentId.Properties.DataSource = null;
                return;
            }
            HospitalInfoEntity hospitalInfo = lueHospital.GetSelectedDataRow() as HospitalInfoEntity;
            //查询上级科室下拉框数据
            String  url  = AppContext.AppConfig.serverUrl + "cms/dept/findAll?hospital.code=" + hospitalInfo.code;// +"&deptIds=" + AppContext.Session.deptIds;
            String  data = HttpClass.httpPost(url);
            JObject objT = JObject.Parse(data);

            if (string.Compare(objT["state"].ToString(), "true", true) == 0)
            {
                List <DeptEntity> deptLsit = objT["result"].ToObject <List <DeptEntity> >();
                DeptEntity        dept     = new DeptEntity();
                dept.id   = "0";
                dept.name = "无";
                deptLsit.Insert(0, dept);

                treeParentId.Properties.DataSource               = deptLsit;
                treeParentId.Properties.TreeList.KeyFieldName    = "id";
                treeParentId.Properties.TreeList.ParentFieldName = "parentId";
                treeParentId.Properties.DisplayMember            = "name";
                treeParentId.Properties.ValueMember              = "id";
            }
            else
            {
                MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK,
                                     MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                return;
            }
        }
        /// <summary>
        /// DELETE Department method
        /// </summary>
        /// <param name="depart"></param>
        /// <returns>
        /// bool value of method's execution
        /// </returns>
        public static bool Remove(Depart depart)
        {
            using (EquipmentsEntities context = new EquipmentsEntities())
            {
                try
                {
                    int        id   = Convert.ToInt32(depart.Id);
                    DeptEntity dept = context.Depts.Single(d => d.Id == id);

                    context.Depts.Remove(dept);

                    var equipments = context.Equip.Where(e => e.DeptsId == dept.Id).ToList();

                    foreach (var eq in equipments)
                    {
                        eq.DeptsId = null;
                    }

                    context.SaveChanges();

                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
Example #3
0
        private void treeMenuControl1_MenuItemClick(object sender, EventArgs e, object selectItem)
        {
            DeptEntity dept       = selectItem as DeptEntity;
            string     hospitalId = dept.hospitalId;

            deptId = dept.id;
            SearchData(1, pageControl1.PageSize, hospitalId, deptId);
        }
        /// <summary>
        /// 科室列表点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="selectItem"></param>
        private void treeMenuControl1_MenuItemClick(object sender, EventArgs e, object selectItem)
        {
            DeptEntity dept = selectItem as DeptEntity;

            SelectDeptid = dept.id;
            ClearReservationUIInfo();
            List <Dictionary <int, String> > dcs = new List <Dictionary <int, String> >();

            reservationCalendar1.ChangeValidDate(dcs);
            this.mcTimeSpan.setDataSources(null, true, "");
            GetDoctorName(AppContext.Session.hospitalId, SelectDeptid);
        }
Example #5
0
        public JsonResult Edit(int id, IFormCollection collection)
        {
            DeptEntity entity = new DeptEntity();

            TryUpdateModelAsync(entity);
            var result = service.Update(entity, AppUser, () =>
            {
                DeptUtil.Clear();
            });

            return(Json(result));
        }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            var        context = new DeptEntity();
            Department dept    = new Department();

            context.Departments.Add(dept);
            dept.ID       = Convert.ToInt32(id.Text);
            dept.Name     = ename.Text;
            dept.Location = elable.Text;

            context.Departments.Add(dept);
            context.SaveChanges();
        }
        /// <summary>
        /// CREATE Department method
        /// </summary>
        /// <param name="depart"></param>
        /// <returns>
        /// bool value of method's execution
        /// </returns>
        public static bool Create(Depart depart)
        {
            using (EquipmentsEntities context = new EquipmentsEntities())
            {
                try
                {
                    DeptEntity newE = new DeptEntity();
                    newE.DeptName = depart.Name;

                    context.Depts.Add(newE);
                    context.SaveChanges();

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
Example #8
0
        /// <summary>
        /// 窗口加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ScheduledListForm_Load(object sender, EventArgs e)
        {
            MainForm          = (Form)this.Parent;
            deBegin.EditValue = DateTime.Now.ToString("yyyy-MM-dd");
            deEnd.EditValue   = DateTime.Now.ToString("yyyy-MM-dd");
            cmd = new Xr.Common.Controls.OpaqueCommand(AppContext.Session.waitControl);

            List <DeptEntity> deptList = Clone <List <DeptEntity> >(AppContext.Session.deptList);
            DeptEntity        dept     = new DeptEntity();

            dept.id   = "`";
            dept.name = "全部";
            deptList.Insert(0, dept);
            treeDept.Properties.DataSource               = deptList;
            treeDept.Properties.TreeList.KeyFieldName    = "id";
            treeDept.Properties.TreeList.ParentFieldName = "parentId";
            treeDept.Properties.DisplayMember            = "name";
            treeDept.Properties.ValueMember              = "id";
            treeDept.EditValue = dept.id;

            //合并值相同的单元格
            gridView1.OptionsView.AllowCellMerge = true;
            //设置表格中状态下拉框的数据
            List <DictEntity> dictList = new List <DictEntity>();
            DictEntity        dict     = new DictEntity();

            dict.value = "0";
            dict.label = "正常";
            dictList.Add(dict);
            dict       = new DictEntity();
            dict.value = "1";
            dict.label = "停诊";
            dictList.Add(dict);
            repositoryItemLookUpEdit1.DataSource    = dictList;
            repositoryItemLookUpEdit1.DisplayMember = "label";
            repositoryItemLookUpEdit1.ValueMember   = "value";
            repositoryItemLookUpEdit1.ShowHeader    = false;
            repositoryItemLookUpEdit1.ShowFooter    = false;
            SearchData();
        }
Example #9
0
        private void treeMenuControl1_MenuItemClick(object sender, EventArgs e, object selectItem)
        {
            DeptEntity dept  = selectItem as DeptEntity;
            String     param = "pageNo=1&pageSize=10000&hospital.id=" + dept.hospitalId + "&dept.id=" + dept.id;
            String     url   = AppContext.AppConfig.serverUrl + "cms/doctor/list?" + param;

            cmd.ShowOpaqueLayer();
            this.DoWorkAsync(500, (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)
                {
                    List <DoctorInfoEntity> doctorList = objT["result"]["list"].ToObject <List <DoctorInfoEntity> >();
                    //设置医生列表
                    List <Item> itemList = new List <Item>();
                    foreach (DoctorInfoEntity doctor in doctorList)
                    {
                        Item item  = new Item();
                        item.name  = doctor.name;
                        item.value = doctor.id;
                        item.tag   = doctor.code;
                        itemList.Add(item);
                    }
                    mcDoctor.setDataSource(itemList);
                    cmd.HideOpaqueLayer();
                }
                else
                {
                    cmd.HideOpaqueLayer();
                    MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
                    return;
                }
            });
        }
Example #10
0
 void GetAll()
 {
     using (SqlConnection conn = new SqlConnection(strConn))//使用using的方式系统自动关闭连接
     {
         //打开数据库连接
         conn.Open();
         //设定SQL叙述
         string        sql = string.Format("select d.deptId,d.deptName,e.name from department d, employee e where d.deptMgrId = e.empId");
         SqlCommand    cmd = new SqlCommand(sql, conn);
         SqlDataReader dr  = cmd.ExecuteReader();
         while (dr.Read())
         {
             DeptEntity deptEntity = new DeptEntity();
             for (int i = 0; i < dr.FieldCount; i++)
             {
                 deptEntity.DeptId   = int.Parse(dr[0].ToString());
                 deptEntity.DeptName = dr[1].ToString();
                 deptEntity.DeptMgr  = dr[2].ToString();
             }
             deptlist.Add(deptEntity);
         }
     }
 }
Example #11
0
        private void UserForm_Load(object sender, EventArgs e)
        {
            MainForm = (Form)this.Parent;
            //Infor();
            cmd = new Xr.Common.Controls.OpaqueCommand(this);
            gridBand3.Caption = gridBand15.Caption = gridBand32.Caption = gridBand13.Caption = "开放总额\r\n(预约+现场)";

            //查询科室下拉框数据
            List <DeptEntity> deptList = Clone <List <DeptEntity> >(AppContext.Session.deptList);
            DeptEntity        dept     = new DeptEntity();

            dept.id   = " ";
            dept.name = "全部";
            deptList.Insert(0, dept);
            treeDeptId.Properties.DataSource               = deptList;
            treeDeptId.Properties.TreeList.KeyFieldName    = "id";
            treeDeptId.Properties.TreeList.ParentFieldName = "parentId";
            treeDeptId.Properties.DisplayMember            = "name";
            treeDeptId.Properties.ValueMember              = "id";
            //默认选择选择第一个
            if (deptList.Count > 0)
            {
                treeDeptId.EditValue = deptList[0].id;
            }

            /*String url = AppContext.AppConfig.serverUrl + "cms/dept/findAll?hospital.code=" + AppContext.AppConfig.hospitalCode + "&code=" + AppContext.AppConfig.deptCode;
             * String data = HttpClass.httpPost(url);
             * JObject objT = JObject.Parse(data);
             * if (string.Compare(objT["state"].ToString(), "true", true) == 0)
             * {
             *  List<DeptEntity> deptList = new List<DeptEntity>() { new DeptEntity { id = " ", parentId = "", name = "请选择" } };
             *  deptList.AddRange(objT["result"].ToObject<List<DeptEntity>>());
             *  //DeptEntity dept = new DeptEntity();
             *  //dept.id = "0";
             *  //dept.name = "无";
             *  //deptList.Insert(0, dept);
             *
             *  treeDeptId.Properties.DataSource = deptList;
             *  treeDeptId.Properties.TreeList.KeyFieldName = "id";
             *  treeDeptId.Properties.TreeList.ParentFieldName = "parentId";
             *  treeDeptId.Properties.DisplayMember = "name";
             *  treeDeptId.Properties.ValueMember = "id";
             * }
             * else
             * {
             *  MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm);
             *  return;
             * }
             * //若没配置科室编码让其选择一个
             * if (AppContext.AppConfig.deptCode == String.Empty)
             * {
             *  treeDeptId.EditValue = " ";
             * }
             * else
             * {
             *
             *  treeDeptId.EditValue = AppContext.Session.deptId;
             * }
             */
            //配置时间格式
            setDateFomartDefult(true);

            TabpageName = xtraTabControl1.SelectedTabPage.Text;
        }
        /// <summary>
        /// 窗口加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ScheduledListForm_Load(object sender, EventArgs e)
        {
            MainForm          = (Form)this.Parent;
            deBegin.EditValue = DateTime.Now.ToString("yyyy-MM-dd");
            deEnd.EditValue   = DateTime.Now.AddDays(11).ToString("yyyy-MM-dd");//修改为当前日期+11之后的日期。
            cmd = new Xr.Common.Controls.OpaqueCommand(AppContext.Session.waitControl);

            bool hzFlag = false;

            foreach (FunctionEntity function in AppContext.Session.functionList)
            {
                if (function.name.Equals("已排班列表门诊特需互转"))
                {
                    hzFlag = true;
                    break;
                }
            }
            if (hzFlag)
            {
                buttonControl2.Visible = hzFlag;
            }
            else
            {
                buttonControl4.Location = new Point(25, 47);
            }

            bool fhFlag = false;

            foreach (FunctionEntity function in AppContext.Session.functionList)
            {
                if (function.name.Equals("已排班列表放号审核"))
                {
                    fhFlag = true;
                    break;
                }
            }
            if (hzFlag && fhFlag)
            {
                buttonControl3.Visible = fhFlag;
            }
            else if (!hzFlag && fhFlag)
            {
                buttonControl3.Visible  = fhFlag;
                buttonControl3.Location = new Point(131, 47);
            }


            bool addFlag = false;

            foreach (FunctionEntity function in AppContext.Session.functionList)
            {
                if (function.name.Equals("已排班列表增加排班"))
                {
                    addFlag = true;
                    break;
                }
            }

            buttonControl1.Visible = addFlag;
            if (hzFlag && !fhFlag)
            {
                buttonControl1.Location = new Point(239, 47);
            }
            if (!hzFlag && fhFlag)
            {
                buttonControl1.Location = new Point(217, 47);
            }
            else if (!hzFlag && !fhFlag)
            {
                buttonControl1.Location = new Point(131, 47);
            }
            //合并值相同的单元格
            gridView1.OptionsView.AllowCellMerge = true;
            //设置表格中状态下拉框的数据
            List <DictEntity> dictList = new List <DictEntity>();
            DictEntity        dict     = new DictEntity();

            dict.value = "0";
            dict.label = "正常";
            dictList.Add(dict);
            dict       = new DictEntity();
            dict.value = "1";
            dict.label = "停诊";
            dictList.Add(dict);
            repositoryItemLookUpEdit1.DataSource    = dictList;
            repositoryItemLookUpEdit1.DisplayMember = "label";
            repositoryItemLookUpEdit1.ValueMember   = "value";
            repositoryItemLookUpEdit1.ShowHeader    = false;
            repositoryItemLookUpEdit1.ShowFooter    = false;

            lookUpEdit1.Properties.DataSource    = dictList;
            lookUpEdit1.Properties.DisplayMember = "label";
            lookUpEdit1.Properties.ValueMember   = "value";
            lookUpEdit1.ItemIndex = 0;

            List <DictEntity> dictList2 = new List <DictEntity>();

            dict       = new DictEntity();
            dict.value = "`";
            dict.label = "全部";
            dictList2.Add(dict);
            dict       = new DictEntity();
            dict.value = "0";
            dict.label = "放号";
            dictList2.Add(dict);
            dict       = new DictEntity();
            dict.value = "1";
            dict.label = "未放号";
            dictList2.Add(dict);

            lookUpEdit2.Properties.DataSource    = dictList2;
            lookUpEdit2.Properties.DisplayMember = "label";
            lookUpEdit2.Properties.ValueMember   = "value";
            lookUpEdit2.ItemIndex = 0;

            cmd.ShowOpaqueLayer(0f);
            //获取可操作科室
            String url = AppContext.AppConfig.serverUrl + "cms/dept/qureyOperateDept";

            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"]["deptList"].ToObject <List <DeptEntity> >();
                    DeptEntity dept            = new DeptEntity();
                    dept.id   = "`";
                    dept.name = "全部";
                    //deptList.Insert(0, dept);
                    treeDept.Properties.DataSource               = deptList;
                    treeDept.Properties.TreeList.KeyFieldName    = "id";
                    treeDept.Properties.TreeList.ParentFieldName = "parentId";
                    treeDept.Properties.DisplayMember            = "name";
                    treeDept.Properties.ValueMember              = "id";
                    treeDept.EditValue = AppContext.Session.deptList[0].id;

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