//Adding a new department
        void AddNew()
        {
            try
            {
                SqlConnection con = new SqlConnection(Strcon);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                SqlCommand cmd  = new SqlCommand("INSERT INTO department(dept_id,dept_name,phone,email) values(@dept_id,@dept_name,@phone,@email)", con);
                SqlCommand cmdd = new SqlCommand("INSERT INTO vaccency(dept_id,vaccency) values(@dept_id,@vaccency)", con);
                cmd.Parameters.AddWithValue("@dept_id", DeptID.Text.Trim());
                cmd.Parameters.AddWithValue("@dept_name", DeptName.Text.Trim());
                cmd.Parameters.AddWithValue("@phone", Phone.Text.Trim());
                cmd.Parameters.AddWithValue("@email", Email.Text.Trim());
                cmdd.Parameters.AddWithValue("@dept_id", DeptID.Text.Trim());
                cmdd.Parameters.AddWithValue("@vaccency", Vaccency.Text.Trim());

                cmd.ExecuteNonQuery();
                cmdd.ExecuteNonQuery();
                con.Close();
                Response.Write("<script>alert('Department added Successfully');</script>");
                ClearForm();
                DeptInfo.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
Пример #2
0
        public int GetQYWaringCount(Selectcarmonitor sm)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];

            if (sm.Businessdivisionid == null || sm.Businessdivisionid.Trim() == "")
            {
                sm.Businessdivisionid = user.EnterId;
            }
            if (sm.Businessdivisioncode == "true")
            {
                DeptInfo dif = new DeptInfo();
                dif = deptInfoBll.GetDeptInfo(sm.Businessdivisionid);
                sm.Businessdivisioncode = dif.Businessdivisioncode;
                sm.Businessdivisionid   = "";
            }
            else
            {
                sm.Businessdivisioncode = "";
            }
            int c = realtimeDataBll.GetQYWaringCount(sm);

            return(c);
        }
Пример #3
0
        /// <summary>
        /// 初始化住院科室列表
        /// </summary>
        private void InitDeptList()
        {
            if (this.cboDeptName == null || this.cboDeptName.IsDisposed)
            {
                return;
            }
            if (this.cboDeptName.Items.Count > 0)
            {
                return;
            }
            //加载科室列表
            List <DeptInfo> lstDeptInfos = null;

            if (EMRDBAccess.Instance.GetWardDeptList(ref lstDeptInfos) != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("临床科室列表下载失败!");
                return;
            }
            if (lstDeptInfos == null || lstDeptInfos.Count <= 0)
            {
                return;
            }
            for (int index = 0; index < lstDeptInfos.Count; index++)
            {
                DeptInfo deptInfo = lstDeptInfos[index];
                this.cboDeptName.Items.Add(deptInfo);
            }
        }
Пример #4
0
 private bool GetSystemContext(string name, ref object value)
 {
     if (name == "所在科室")
     {
         string   szDeptName = "全科";
         DeptInfo deptInfo   = this.cboDeptName.SelectedItem as  DeptInfo;
         if (deptInfo != null)
         {
             szDeptName = deptInfo.DEPT_NAME;
         }
         if (string.IsNullOrEmpty(this.cboDeptName.Text))
         {
             szDeptName = "全科";
         }
         value = szDeptName;
         return(true);
     }
     if (name == "起始日期")
     {
         value = this.dtpStatTimeBegin.Value;
         return(true);
     }
     if (name == "截止日期")
     {
         value = this.dtpStatTimeEnd.Value;
         return(true);
     }
     return(false);
 }
        public string GetCarTypeList(string TypeMode, string DeptId)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            if (user != null)
            {
                DeptInfo    di = deptInfoBll.GetDeptInfo(user.EnterId);
                CarTypeList ct = new CarTypeList();
                if (DeptId != null && DeptId.Trim() != "")
                {
                    ct.Businessdivisionid = DeptId;
                }
                else
                {
                    ct.Businessdivisioncode = di.Businessdivisioncode;
                }

                IList <CarTypeList> ictlist = carTypeBll.GetCarTypeList(ct);
                if (TypeMode == "true")
                {
                    CarTypeList c = new CarTypeList();
                    c.TypeId   = "";
                    c.TypeName = "--选择车辆类型--";
                    ictlist.Insert(0, c);
                }
                string json = ConvertToJson(ictlist);
                return(json);
            }
            else
            {
                return("");
            }
        }
        public int TerExChange(TerminalInfo entity, bool flag)
        {
            if (entity.TerGuid != null && entity.TerGuid.Trim() != "")
            {
                string   TerGuids   = "";
                string   RealTerNos = "";
                string[] TerArr     = entity.TerGuid.Trim(',').Split(',');

                for (int i = 0; i < TerArr.Length; i++)
                {
                    DeptInfoBLL  deptInfoBll = new DeptInfoBLL();
                    TerminalInfo terinfo     = this.GetTerminalInfo(TerArr[i]);
                    DeptInfo     scdi        = deptInfoBll.GetDeptInfo("dabf8b57-75a3-43f8-b540-03fefc9e43c3"); //生产测试的类
                    if (terinfo.TerDeptcode.StartsWith(scdi.Businessdivisioncode))
                    {
                        RealTerNos += "'" + terinfo.TerNo + "',";
                    }
                    TerGuids += "'" + TerArr[i] + "',";
                }
                entity.TerGuid = TerGuids.Trim(',');
                if (RealTerNos.Trim(',') != "" && flag == false)
                {
                    entity.TerNo = RealTerNos.Trim(',');
                    int result = _iTerminalInfoDao.SetReplyRealdata(entity);
                }
                int k = _iTerminalInfoDao.CarExChange(entity);
                return(_iTerminalInfoDao.TerExChange(entity));
            }
            else
            {
                return(0);
            }
        }
Пример #7
0
        /// <summary>
        /// 修改部门
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateDept(DeptInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OA_Dept set ");
            strSql.Append("DeptCode=@DeptCode,");
            strSql.Append("DeptName=@DeptName,");
            strSql.Append("ParentDeptID=@ParentDeptID,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where DeptID=@DeptID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DeptID",       SqlDbType.VarChar,  36),
                new SqlParameter("@DeptCode",     SqlDbType.NVarChar, 50),
                new SqlParameter("@DeptName",     SqlDbType.NVarChar, 50),
                new SqlParameter("@ParentDeptID", SqlDbType.VarChar,  36),
                new SqlParameter("@Remark",       SqlDbType.NVarChar, 500)
            };
            parameters[0].Value = model.DeptID;
            parameters[1].Value = model.DeptCode;
            parameters[2].Value = model.DeptName;
            parameters[3].Value = model.ParentDeptID;
            parameters[4].Value = model.Remark;

            int rows = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public string AddEnter(DeptInfo deptInfo)
        {
            try
            {
                object o = deptInfoBll.Insert(deptInfo);

                //刷新缓存
                UserInfo user = new UserInfo();
                user = (UserInfo)Session["LoginUser"];

                new LogMessage().Save("名称:" + deptInfo.Businessdivisionname + "。");

                string cache_name = "CurUserTreeModeList_" + user.EnterId;
                if (CacheHelper.Get(cache_name) != null)
                {
                    CacheHelper.Remove(cache_name);
                }

                //刷新部门
                Transfers.ClintSendCommData(1160, "1108", "", "", "", "", "", "", "", "", "", "1", "0", "", "", "", "", "", "");
                return(o.ToString());
            }
            catch (Exception)
            {
                return("false");
            }
        }
Пример #9
0
        void BindData()
        {
            CreateWaitDialog("正在查询....", "请稍等");

            List <EmployeePayData> dataList = new List <EmployeePayData>(list);

            //如果输入的不是姓名只显示当前机构下员工
            if (searchKey.Text.Trim().Length == 0)
            {
                if (treeView1.SelectedNode != null)
                {
                    DeptInfo dept = treeView1.SelectedNode.Tag as DeptInfo;
                    dataList = dataList.FindAll(a => a.员工信息.部门 == dept.部门编号 || chk包括下属机构.Checked && dept.IsDescendant(a.所属部门));
                }
            }
            else
            {
                //不支持模糊查找,按姓名查询是和部门无关
                dataList = dataList.FindAll(a => a.姓名 == searchKey.Text.Trim());
            }

            gridControl1.DataSource = dataList;
            gridView1.ExpandAllGroups();

            CloseWaitDialog();
        }
Пример #10
0
        /// <summary>
        /// 获取部门List
        /// </summary>
        /// <returns></returns>
        public IList <DeptInfo> GetDeptList()
        {
            IDataReader reader = null;

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.AppendFormat(" select * from OA_Dept ");
                IList <DeptInfo> list = new List <DeptInfo>();
                reader = DBAccess.ExecuteReader(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), null);
                while (reader.Read())
                {
                    DeptInfo info = new DeptInfo();
                    this.ReaderToObject(reader, info);
                    list.Add(info);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Close();
            }
        }
Пример #11
0
        /// <summary>
        /// 加载临床科室列表
        /// </summary>
        private void LoadDeptList()
        {
            this.cboDeptList.Items.Clear();

            List <DeptInfo> lstDeptInfos = null;
            short           shResult     = EMRDBAccess.Instance.GetAllDeptInfos(ref lstDeptInfos);

            if (shResult != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("获取科室信息列表时发生错误!");
                return;
            }
            if (lstDeptInfos == null)
            {
                return;
            }
            for (int index = 0; index < lstDeptInfos.Count; index++)
            {
                DeptInfo deptInfo = lstDeptInfos[index];
                if (deptInfo != null)
                {
                    this.cboDeptList.Items.Add(deptInfo.InputCode.ToLower(), deptInfo);
                }
            }
        }
Пример #12
0
        public FrmBedEdit(DeptInfo deptInfo, RoomInfo roomInfo)
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
            //新增床位
            //
            _addNew = true;
            AddButtonToTextBox(this.btnChargeDoc, this.txtChargeDoc);
            AddButtonToTextBox(this.btnManageDoc, this.txtManageDoc);
            AddButtonToTextBox(this.btnFunNurse, this.txtFunNurse);
            AddButtonToTextBox(this.btnLinkFee, this.txtLinkFee);
            #region 初始化录入控件
            this.ClearTextBoxInfo(this.txtChargeDoc);
            this.ClearTextBoxInfo(this.txtManageDoc);
            this.ClearTextBoxInfo(this.txtFunNurse);
            this.ClearTextBoxInfo(this.txtLinkFee);
            #endregion
            _deptInfo          = deptInfo;
            _roomInfo          = roomInfo;
            _bedInfo           = new BedInfo();
            lblWardInfo.Text   = "病区:[" + roomInfo.WardName + "] 科室:[" + deptInfo.DeptName + "]";
            lblCaption.Text    = "新增病房";
            this.Text          = lblCaption.Text;
            this.txtBedNo.Text = this.GetDefaultBedNo();

            LoadWardDept(deptInfo.WardID);
        }
Пример #13
0
 /// <summary>
 /// 初始化科室勾选状态
 /// </summary>
 private void InitDeptCheckState()
 {
     for (int index = 0; index < this.listView1.Items.Count; index++)
     {
         this.listView1.Items[index].Checked = false;
     }
     if (this.m_arrDeptInfo == null || this.m_arrDeptInfo.Length <= 0)
     {
         return;
     }
     if (this.m_htDeptItem == null || this.m_htDeptItem.Count <= 0)
     {
         return;
     }
     for (int index = 0; index < this.m_arrDeptInfo.Length; index++)
     {
         DeptInfo deptInfo = this.m_arrDeptInfo[index];
         if (deptInfo == null || string.IsNullOrEmpty(deptInfo.DEPT_CODE))
         {
             continue;
         }
         if (!this.m_htDeptItem.Contains(deptInfo.DEPT_CODE))
         {
             continue;
         }
         ListViewItem item = this.m_htDeptItem[deptInfo.DEPT_CODE] as ListViewItem;
         if (item != null)
         {
             item.Checked = true;
         }
     }
 }
Пример #14
0
        private void QueryByDept()
        {
            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            string   szDeptName = this.cboDeptList.Text;
            DeptInfo deptInfo   = this.cboDeptList.SelectedItem as DeptInfo;

            if (deptInfo == null || deptInfo.DEPT_NAME != szDeptName)
            {
                object objItem = null;
                if (szDeptName != string.Empty)
                {
                    objItem = this.cboDeptList.GetItem(szDeptName, false);
                }
                deptInfo = objItem as DeptInfo;
            }
            if (deptInfo == null)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                MessageBoxEx.Show("您输入的科室不存在!"
                                  , MessageBoxIcon.Information);
                return;
            }
            List <UserInfo> lstUserInfos = null;
            short           shRet        = EMRDBAccess.Instance.GetDeptUserList(deptInfo.DEPT_CODE, ref lstUserInfos);

            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                MessageBoxEx.Show("用户列表查询下载失败!");
                return;
            }
            this.LoadGridViewData(lstUserInfos);
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Пример #15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ListQcAdminDepts.Clear();
            foreach (Control item in this.flpGrant.Controls)
            {
                CheckBox chk = item as CheckBox;
                if (item == null)
                {
                    continue;
                }
                if (chk.Checked == false)
                {
                    continue;
                }
                DeptInfo     dpetDict     = chk.Tag as DeptInfo;
                QcAdminDepts qcAdminDepts = new QcAdminDepts();
                qcAdminDepts.DEPT_CODE = dpetDict.DEPT_CODE;
                qcAdminDepts.DEPT_NAME = dpetDict.DEPT_NAME;
                qcAdminDepts.USER_ID   = this.UserInfo.USER_ID;
                qcAdminDepts.USER_NAME = this.UserInfo.USER_NAME;
                ListQcAdminDepts.Add(qcAdminDepts);
            }
            short shRet = QcAdminDeptsAccess.Instance.SaveQcAdminDeptsList(this.UserInfo.USER_ID, ListQcAdminDepts);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("管辖科室设置失败!");
                return;
            }
            MessageBoxEx.ShowMessage("管辖科室设置成功!");
        }
Пример #16
0
        public ActionResult UpdateEmp(EMPLOYEE_MODEL model)
        {
            JsonSMsg rMsg = new JsonSMsg();

            string accessToken = HmjClientServiceApi.Create().GetAccessToken();

            DeptInfo dept = new DeptInfo();

            dept.ID = model.EmpGroupId;
            string errMsg = null;
            int    rows   = EmployeeService.SaveEmployee(accessToken, model, dept, ref errMsg);

            if (rows > 0)
            {
                rMsg.Status = 1;
            }
            else
            {
                if (string.IsNullOrEmpty(errMsg))
                {
                    errMsg = "保存失败。";
                }
                rMsg.Message = errMsg;
            }

            return(Json(rMsg));
        }
Пример #17
0
        static void Main(string[] args)
        {
            Console.WriteLine("rows -->影响数据的行数,-1 表示操作员编号已经存在 ");
            Console.WriteLine();
            StaffInfo newstaffinfo = new StaffInfo();

            newstaffinfo.StaffID      = "3";
            newstaffinfo.StaffName    = "王大锤";
            newstaffinfo.BelongDeptId = 2;
            DeptInfo newdeptinfo = new DeptInfo();

            newdeptinfo.DeptID    = 1;
            newdeptinfo.DeptName  = "测试部";
            newdeptinfo.DeptPhone = "12312312";

            AddStaffMgr AddStaffmger = new AddStaffMgr(newstaffinfo);

            AddStaffmger.Execute();

            StaffQueryMgr StaffQuery = new StaffQueryMgr(newstaffinfo.StaffID);

            StaffQuery.Execute();
            List <StaffDeptInfo> staffDeptinfoList = StaffQuery.StaffDeptinfoList;

            DeleteStaffMgr DeleteStaff = new DeleteStaffMgr(newstaffinfo.StaffID);

            DeleteStaff.Execute();

            UpdataStaffMgr UpdataStaff = new UpdataStaffMgr(newstaffinfo);

            UpdataStaff.Execute();

            Console.ReadLine();
        }
Пример #18
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            this.ShowStatusMessage("正在统计延期未提交病历信息,请稍候...");
            this.dataGridView1.Rows.Clear();
            DeptInfo deptInfo   = this.cboDeptName.SelectedItem as DeptInfo;
            string   szDeptCode = null;

            if (deptInfo != null)
            {
                szDeptCode = deptInfo.DEPT_CODE;
            }
            if (string.IsNullOrEmpty(this.cboDeptName.Text))
            {
                szDeptCode = null;
            }
            string szDelayDays = this.numericUpDown1.Value.ToString();
            List <EMRDBLib.PatVisitInfo> lstPatVisitLog = null;
            short shRet = SystemData.ReturnValue.OK;

            shRet = MedQCAccess.Instance.GetDelayUnCommitDocInfos(szDeptCode, szDelayDays, ref lstPatVisitLog);
            if (shRet != SystemData.ReturnValue.OK || lstPatVisitLog == null)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                this.ShowStatusMessage(null);
                return;
            }
            this.LoadDelyUnCommitDocInfos(lstPatVisitLog);
            this.dataGridView1.Tag = "延期未提交病历查询清单";
            this.ShowStatusMessage(null);
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Пример #19
0
        public string GetRoleList(RoleView ri, string ChildrenSel, int rows, int page)
        {
            //RoleView ri = new RoleView();
            if (ri.DeptId == null || ri.DeptId.Trim() == "")
            {
                UserInfo user = new UserInfo();
                user      = (UserInfo)Session["LoginUser"];
                ri.DeptId = user.EnterId;
            }

            if (ChildrenSel == "true")
            {
                DeptInfo di = deptInfoBll.GetDeptInfo(ri.DeptId);
                if (di != null)
                {
                    ri.Businessdivisioncode = di.Businessdivisioncode;
                    ri.DeptId = "";
                }
            }
            ri.StartData = (page - 1) * rows + 1;
            ri.EndData   = ri.StartData + rows;
            IList <RoleView> iri = roleInfoBll.GetRoleInfoPage(ri);
            int total            = roleInfoBll.GetRoleInfoCount(ri);

            return(ConvertToJson(iri, total));
        }
Пример #20
0
        public ActionResult AddUserForm(UserInfo ui)
        {
            ui.UserId = System.Guid.NewGuid().ToString();

            if (ui.RoleId == null || ui.RoleId == "")
            {
                return(JavaScript("submitFormError('用户角色不能为空');"));
            }
            if (ui.EnterId != null && ui.EnterId != "")
            {
                DeptInfo di = deptInfoBll.GetDeptInfo(ui.EnterId);
                ui.UserDeptcode = di.Businessdivisioncode;
            }
            else
            {
                return(JavaScript("submitFormError('所属企业不正确或者为空');"));
            }
            if (ui.UserPasswrd != null && ui.UserPasswrd != "")
            {
                ui.UserPasswrd = FormsAuthentication.HashPasswordForStoringInConfigFile(ui.UserPasswrd, "md5");
            }
            else
            {
                return(JavaScript("submitFormError('用户密码不能为空');"));
            }
            ui.UserFunct = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,";
            string[] arr = ui.UserFunct.Split(',');
            if (ui.UserFunct1 == "InstallCar")
            {
                arr[19] = "1";
            }
            if (ui.UserFunct2 == "SendCmd")
            {
                arr[18] = "1";
            }
            ui.UserFunct = string.Join(",", arr);
            ui.UserLname = ui.UserLname.Trim();
            int i = userInfoBll.Insert(ui);

            new LogMessage().Save("名称:" + ui.UserName + "。");

            if (i == 0)
            {
                //刷新用户
                Transfers.ClintSendCommData(1160, "1108", "", "", "", "", "", "", "", "", "", "1", "1", "", "", "", "", "", "");
                return(JavaScript("submitFormSucceed();"));
            }
            else
            {
                if (i == 2)
                {
                    return(JavaScript("submitFormError('用户名已存在');"));
                }
                else
                {
                    return(JavaScript("submitFormError();"));
                }
            }
        }
Пример #21
0
        protected override void ShowItemInGridViewRow(DataGridViewRow row, object item)
        {
            DeptInfo info = item as DeptInfo;

            row.Tag = item;
            row.Cells["colName"].Value  = info.DeptName;
            row.Cells["colDescr"].Value = info.Descrption;
        }
Пример #22
0
        public ActionResult EditTerUser(UserInfo ui)
        {
            UserInfo user = userInfoBll.GetTerUserInfo(ui);
            DeptInfo di   = deptInfoBll.GetDeptInfoByCode(user.UserBuildcode);

            ViewBag.EnterId = di.Businessdivisionid;
            return(View(user));
        }
Пример #23
0
        protected override void ItemShowing()
        {
            DeptInfo info = (DeptInfo)UpdatingItem;

            this.Text                = info.DeptName;
            this.txtDeptName.Text    = info.DeptName;
            this.txtDescription.Text = info.Descrption;
        }
Пример #24
0
        public short GetDocAdminDeptsList(string szUserID, ref List <DeptInfo> lstDeptInfos)
        {
            if (string.IsNullOrEmpty(szUserID))
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }
            string szField = string.Format("{0},{1}"
                                           , SystemData.DeptView.DEPT_CODE, SystemData.DeptView.DEPT_NAME
                                           );

            string szCondition = string.Format(" USER_ID='{0}'", szUserID);
            string szSQL       = string.Format(SystemData.SQL.SELECT_WHERE, szField, SystemData.DataView.DOC_ADMIN_DEPTS_V, szCondition
                                               );
            IDataReader dataReader = null;

            try
            {
                dataReader = base.MeddocAccess.ExecuteReader(szSQL, CommandType.Text);
                if (dataReader == null || dataReader.IsClosed || !dataReader.Read())
                {
                    return(SystemData.ReturnValue.RES_NO_FOUND);
                }
                if (lstDeptInfos == null)
                {
                    lstDeptInfos = new List <DeptInfo>();
                }
                do
                {
                    DeptInfo deptInfo = new  DeptInfo();
                    if (!dataReader.IsDBNull(0))
                    {
                        deptInfo.DEPT_CODE = dataReader.GetString(0);
                    }
                    if (!dataReader.IsDBNull(1))
                    {
                        deptInfo.DEPT_NAME = dataReader.GetString(1);
                    }
                    lstDeptInfos.Add(deptInfo);
                } while (dataReader.Read());
                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("EMRDBAccess.GetDocAdminDeptsList", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Close();
                    dataReader.Dispose();
                    dataReader = null;
                }
                base.MeddocAccess.CloseConnnection(false);
            }
        }
Пример #25
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            DeptInfo deptInfo   = this.cboDeptName.SelectedItem as DeptInfo;
            string   szDeptCode = null;

            if (deptInfo != null)
            {
                szDeptCode = deptInfo.DEPT_CODE;
            }
            if (string.IsNullOrEmpty(this.cboDeptName.Text))
            {
                szDeptCode = null;
            }
            string szPatientID   = txtPatientID.Text.Trim();
            string szPatientName = txtPatientName.Text.Trim();

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            this.ShowStatusMessage("正在查询数据,请稍候...");
            this.dataGridView1.Rows.Clear();
            List <EMRDBLib.Operation> lstOperation = null;
            short shRet = SystemData.ReturnValue.OK;

            if (!string.IsNullOrEmpty(szPatientID) || !string.IsNullOrEmpty(szPatientName))
            {
                shRet = OperationAccess.Instance.GetOperations(szPatientID, szPatientName, ref lstOperation);
            }
            else
            {
                shRet = OperationAccess.Instance.GetOperations(szDeptCode, DateTime.Parse(dtpStatTimeBegin.Value.ToString("yyyy-M-d 00:00:00")),
                                                               DateTime.Parse(dtpStatTimeEnd.Value.ToString("yyyy-M-d 23:59:59")), ref lstOperation);
            }
            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                MessageBoxEx.Show("查询数据失败!");
                return;
            }
            if (lstOperation == null || lstOperation.Count <= 0)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                this.MainForm.ShowStatusMessage("没有找到符合条件的结果");
                return;
            }
            string pre       = null;
            int    nRowIndex = 0;

            for (int index = 0; index < lstOperation.Count; index++)
            {
                EMRDBLib.Operation operation = lstOperation[index];
                nRowIndex = this.dataGridView1.Rows.Add();
                DataGridViewRow row = this.dataGridView1.Rows[nRowIndex];
                this.SetRowData(row, operation);
            }
            this.ShowStatusMessage(string.Format("查询结果总数:{0}条", this.dataGridView1.Rows.Count.ToString()));
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Пример #26
0
        public string GetList(Selectcarmonitor rtv, string DeptCode, string SelType, int RowNumber)
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];

            DeptInfo  dif = new DeptInfo();
            Hashtable ht  = new Hashtable();

            ht.Add("TerStatus", rtv.TerStatus);
            ht.Add("TerNo", rtv.TerNo == null ? "" : rtv.TerNo.Trim().ToUpper());
            //ht.Add("CarNo", rtv.CarNo == null ? "" : rtv.CarNo.Trim());
            //ht.Add("CarAdminName", rtv.CarAdminName == null ? "" : rtv.CarAdminName.Trim());
            ht.Add("StartData", rtv.StartData);
            ht.Add("EndData", 0); // RowNumber * 20 + 1
            ht.Add("ReplydataCode", rtv.ReplydataCode == null?"":rtv.ReplydataCode.Trim());
            ht.Add("Northorsouth", rtv.Northorsouth);
            if (rtv.Businessdivisionid != null && rtv.Businessdivisionid.Trim() == "")
            {
                if (user.EnterId != null)
                {
                    ht.Add("Businessdivisionid", user.EnterId);
                }
                else
                {
                    ht.Add("UserLname", user.UserLname);
                }
            }
            else
            {
                ht.Add("Businessdivisionid", rtv.Businessdivisionid);
            }

            if (DeptCode == "true")
            {
                if (user.EnterId != null)
                {
                    dif = deptInfoBll.GetDeptInfo(ht["Businessdivisionid"].ToString());
                    ht.Add("Businessdivisioncode", dif.Businessdivisioncode);
                    ht["Businessdivisionid"] = "";
                }
            }

            if (SelType == "Ter" || SelType == "Dept")
            {
                ht.Add("SelType", "true");
            }
            else
            {
                ht.Add("SelType", "");
            }

            IList <Selectcarmonitor> irt = realtimeDataBll.SelectCarMonitor(ht);
            string uu = ConvertToJson(irt);

            return(uu);
        }
Пример #27
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            DeptInfo deptInfo   = this.cboDeptName.SelectedItem as  DeptInfo;
            string   szDeptCode = null;

            if (deptInfo != null)
            {
                szDeptCode = deptInfo.DEPT_CODE;
            }
            if (string.IsNullOrEmpty(this.cboDeptName.Text))
            {
                szDeptCode = null;
            }
            string szOrderText = this.txtOrderText.Text.Trim();

            if (string.IsNullOrEmpty(szDeptCode))
            {
                MessageBoxEx.Show("医嘱数据量过大,请先选择科室!");
                return;
            }
            if (string.IsNullOrEmpty(szOrderText))
            {
                MessageBoxEx.Show("检索必须输入医嘱内容!");
                return;
            }

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            this.ShowStatusMessage("正在查询数据,请稍候...");
            this.dataGridView1.Rows.Clear();
            List <PatVisitInfo> lstPatVisitLog = null;
            short shRet = OrdersAccess.Instance.GetPatientListByOrderText(szOrderText, szDeptCode, ref lstPatVisitLog);

            if (shRet != SystemData.ReturnValue.OK)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                MessageBoxEx.Show("查询数据失败!");
                this.ShowStatusMessage(null);
                return;
            }
            if (lstPatVisitLog == null || lstPatVisitLog.Count <= 0)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                MessageBoxEx.Show("没有符合条件的数据!", MessageBoxIcon.Information);
                this.ShowStatusMessage(null);
                return;
            }
            for (int index = 0; index < lstPatVisitLog.Count; index++)
            {
                PatVisitInfo    patVisitLog = lstPatVisitLog[index];
                int             nRowIndex   = this.dataGridView1.Rows.Add();
                DataGridViewRow row         = this.dataGridView1.Rows[nRowIndex];
                this.SetRowData(row, patVisitLog);
            }
            this.ShowStatusMessage(null);
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Пример #28
0
    /// <summary>
    ///
    /// </summary>
    private void GetInfo(string DeptId)
    {
        DeptInfo info = _dept.GetDeptInfo(DeptId);

        this.TXT_DEPTNAME.Text          = info.DeptName;
        this.TXT_REMARK.Text            = info.Remark;
        this.DDL_DEPT.SelectedValue     = info.ParentId;
        this.TXT_DEPTID.Text            = info.DeptId;
        this.DDL_DEPTTYPE.SelectedValue = info.DeptType;
    }
Пример #29
0
        public string GetRoleTree()
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            DeptInfo         di  = deptInfoBll.GetDeptInfo(user.EnterId);
            IList <RoleView> iri = roleInfoBll.GetRoleInfoDownList(di.Businessdivisioncode);

            return(ConvertToJson(iri));
        }
Пример #30
0
        public ActionResult TerUserList()
        {
            IList <MenuInfo> imi = (IList <MenuInfo>)Session["Right"];

            ViewBag.AddDept  = "false";
            ViewBag.EditDept = "false";
            ViewBag.DelDept  = "false";

            ViewBag.AddUser  = "******";
            ViewBag.EditUser = "******";
            ViewBag.DelUser  = "******";
            ViewBag.PwdReste = "false";

            UserInfo user = new UserInfo();

            user           = (UserInfo)Session["LoginUser"];
            ViewBag.Deptid = user.EnterId;
            DeptInfo di = deptInfoBll.GetDeptInfo(user.EnterId);

            ViewBag.Deptname = di.Businessdivisionname;
            for (int i = 0; i < imi.Count; i++)
            {
                switch (imi[i].MenuName)
                {
                case "添加企业":
                    ViewBag.AddDept = "true";
                    break;

                case "删除企业":
                    ViewBag.DelDept = "true";
                    break;

                case "编辑企业":
                    ViewBag.EditDept = "true";
                    break;

                case "添加用户":
                    ViewBag.AddUser = "******";
                    break;

                case "删除用户":
                    ViewBag.DelUser = "******";
                    break;

                case "修改用户":
                    ViewBag.EditUser = "******";
                    break;

                case "密码初始化":
                    ViewBag.PwdReste = "true";
                    break;
                }
            }
            return(View());
        }
Пример #31
0
 public bool CreateDept(DeptInfo info)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append("    Insert Into deptinfo ");
     sql.Append("        ( deptid,deptname, parentid, remark,DEPTTYPE) ");
     sql.Append("    Values( ");
     sql.Append("         '" + info.DeptId + "',");
     sql.Append("         '" + info.DeptName + "',");
     sql.Append("         '" + info.ParentId + "',");
     sql.Append("         '" + info.Remark + "',");
     sql.Append("         '" + info.DeptType + "'");
     sql.Append("    ) ");
     return DataBaseManage.ExecuteSql(sql.ToString()) > 0;
 }
Пример #32
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool ModifyDept(DeptInfo info)
 {
     return _dept.ModifyDept(info);
 }
Пример #33
0
        /// <summary>
        /// List data
        /// </summary>
        private void ShowData()
        {
            try
            {
                string buildingId = Func.ParseString(Session["__BUILDINGID__"]);
                Hashtable PaymentList = new Hashtable();
                string sqlWhere = "";
                if (!String.IsNullOrEmpty(drpMonth.SelectedValue) && String.IsNullOrEmpty(drpYear.SelectedValue))
                {
                    sqlWhere = " and YearMonth like '%" + drpMonth.SelectedValue + "'";
                }
                else if (String.IsNullOrEmpty(drpMonth.SelectedValue) && !String.IsNullOrEmpty(drpYear.SelectedValue))
                {
                    sqlWhere = " and YearMonth like '" + drpYear.SelectedValue + "%'";
                }
                if (!String.IsNullOrEmpty(drpMonth.SelectedValue) && !String.IsNullOrEmpty(drpYear.SelectedValue))
                {
                    sqlWhere = " and YearMonth = '" + drpYear.SelectedValue + drpMonth.SelectedValue + "'";
                }
                string sql = "Select * from v_PaymentBillDetail Where BuildingId = '" + buildingId + "' " + sqlWhere + " and CustomerId = '" + lblCustomerId.Text + "' order by YearMonth";

                DataTable dt = DbHelper.GetDataTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    string CustomerId = dr["CustomerId"].ToString();
                    string YearMonth = dr["YearMonth"].ToString();
                    string key = CustomerId + "_" + YearMonth;
                    DeptInfo tmp;

                    if (!PaymentList.Contains(key))
                    {
                        tmp = new DeptInfo();
                        tmp.CustomerId = CustomerId;
                        //tmp.Customer = Func.ParseString(CusList[CustomerId]);
                        tmp.YearMonth = YearMonth;
                        PaymentList.Add(key, tmp);
                    }
                    string PaymentType = dr["PaymentType"].ToString();

                    double MoneyUSD = Func.ParseDouble(dr["MoneyUSD"]);
                    double MoneyVND = Func.ParseDouble(dr["MoneyVND"]);
                    double PaidUSD = Func.ParseDouble(dr["PaidUSD"]);
                    double PaidVND = Func.ParseDouble(dr["PaidVND"]);

                    tmp = (DeptInfo)PaymentList[key];
                    switch (PaymentType)
                    {
                        case "1":
                            tmp.RentUSD = MoneyUSD;
                            tmp.RentVND = MoneyVND;
                            tmp.RentPaidUSD = PaidUSD;
                            tmp.RentPaidVND = PaidVND;
                            break;
                        case "2":
                            tmp.ManagerUSD = MoneyUSD;
                            tmp.ManagerVND = MoneyVND;
                            tmp.ManagerPaidUSD = PaidUSD;
                            tmp.ManagerPaidVND = PaidVND;
                            break;
                        case "3":
                            tmp.ParkingUSD = MoneyUSD;
                            tmp.ParkingVND = MoneyVND;
                            tmp.ParkingPaidUSD = PaidUSD;
                            tmp.ParkingPaidVND = PaidVND;
                            break;
                        case "4":
                            tmp.ExtraUSD = MoneyUSD;
                            tmp.ExtraVND = MoneyVND;
                            tmp.ExtraPaidUSD = PaidUSD;
                            tmp.ExtraPaidVND = PaidVND;
                            break;
                        case "5":
                            tmp.ElecUSD = MoneyUSD;
                            tmp.ElecVND = MoneyVND;
                            tmp.ElecPaidUSD = PaidUSD;
                            tmp.ElecPaidVND = PaidVND;
                            break;
                        case "6":
                            tmp.WaterUSD = MoneyUSD;
                            tmp.WaterVND = MoneyVND;
                            tmp.WaterPaidUSD = PaidUSD;
                            tmp.WaterPaidVND = PaidVND;
                            break;
                        case "7":
                            tmp.ServiceUSD = MoneyUSD;
                            tmp.ServiceVND = MoneyVND;
                            tmp.ServicePaidUSD = PaidUSD;
                            tmp.ServicePaidVND = PaidVND;
                            break;
                        case "8":
                            tmp.BookingUSD = MoneyUSD;
                            tmp.BookingVND = MoneyVND;
                            tmp.BookingPaidUSD = PaidUSD;
                            tmp.BookingPaidVND = PaidVND;
                            break;
                        default:
                            break;
                    }
                }
                DataTable cusDeptInfo = new DataTable();
                cusDeptInfo.Columns.Add("YearMonth", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("RentUsd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("RentVnd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ManagerUsd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ManagerVnd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ParkingUsd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ParkingVnd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ExtraTimeUsd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ExtraTimeVnd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ElecVnd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("WaterVnd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ServiceUsd", Type.GetType("System.String"));
                cusDeptInfo.Columns.Add("ServiceVnd", Type.GetType("System.String"));

                foreach (DictionaryEntry tmp in PaymentList)
                {
                    string key = (string)tmp.Key;
                    DeptInfo dept = (DeptInfo)tmp.Value;

                    DataRow newRow = cusDeptInfo.NewRow();
                    newRow["YearMonth"] = dept.YearMonth;
                    newRow["RentUsd"] = dept.RentDeptUSD();
                    newRow["RentVnd"] = dept.RentDeptVND();
                    newRow["ManagerUsd"] = dept.ManagerDeptUSD();
                    newRow["ManagerVnd"] = dept.ManagerDeptVND();
                    newRow["ParkingUsd"] = dept.ParkingDeptUSD();
                    newRow["ParkingVnd"] = dept.ParkingDeptVND();
                    newRow["ExtraTimeUsd"] = dept.ExtraDeptUSD();
                    newRow["ExtraTimeVnd"] = dept.ExtraDeptVND();
                    newRow["ElecVnd"] = dept.ElecDeptVND();
                    newRow["WaterVnd"] = dept.WaterDeptVND();
                    newRow["ServiceUsd"] = dept.ServiceDeptUSD();
                    newRow["ServiceVnd"] = dept.ServiceDeptVND();

                    cusDeptInfo.Rows.Add(newRow);
                }
                rptList.DataSource = cusDeptInfo.DefaultView;
                rptList.DataBind();
                pager.Count = cusDeptInfo.Rows.Count;
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteError(ex);
            }
        }
Пример #34
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 private DeptInfo SetInfo()
 {
     DeptInfo info = new DeptInfo();
     info.DeptName = this.TXT_DEPTNAME.Text.Trim();
     info.ParentId = this.DDL_DEPT.SelectedValue;
     info.Remark = this.TXT_REMARK.Text.Trim();
     info.DeptId = this.TXT_DEPTID.Text.Trim();
     info.DeptType = this.DDL_DEPTTYPE.SelectedValue;
     return info;
 }
Пример #35
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private DeptInfo BuilderEntity(DbDataReader reader)
        {
            DeptInfo info = new DeptInfo();

            info.DeptId = (reader.IsDBNull(reader.GetOrdinal("deptid"))) ? "" : reader["deptid"].ToString();
            info.DeptName = (reader.IsDBNull(reader.GetOrdinal("deptname"))) ? "" : reader["deptname"].ToString();
            info.ParentId = (reader.IsDBNull(reader.GetOrdinal("parentid"))) ? "" : reader["parentid"].ToString();
            info.Remark = (reader.IsDBNull(reader.GetOrdinal("remark"))) ? "" : reader["remark"].ToString();
            info.DeptType = (reader.IsDBNull(reader.GetOrdinal("DEPTTYPE"))) ? "" : reader["DEPTTYPE"].ToString();
            return info;
        }
Пример #36
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool ModifyDept(DeptInfo info)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append(" Update deptinfo ");
     sql.Append("    Set deptname = '" + info.DeptName + "',");
     sql.Append("        parentid = '" + info.ParentId + "', ");
     sql.Append("        remark = '" + info.Remark + "', ");
     sql.Append("        DEPTTYPE = '" + info.DeptType + "' ");
     sql.Append("   Where deptid = '" + info.DeptId + "'");
     return DataBaseManage.ExecuteSql(sql.ToString()) > 0;
 }
Пример #37
0
 public bool CreateDept(DeptInfo info)
 {
     return _dept.CreateDept(info);
 }
Пример #38
0
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExport_Click(object sender, EventArgs e)
        {
            string buildingId = Func.ParseString(Session["__BUILDINGID__"]);
            string sql = "Select CustomerId, Name From Customer Where BuildingId = '" + buildingId + "' and DelFlag = 0 order by CustomerId";
            Hashtable CusList = new Hashtable();
            DataTable dtCus = DbHelper.GetDataTable(sql);
            foreach (DataRow drCus in dtCus.Rows)
            {
                if (!CusList.Contains(drCus["CustomerId"].ToString()))
                {
                    CusList.Add(drCus["CustomerId"].ToString(), drCus["Name"].ToString());
                }
            }

            Hashtable PaymentList = new Hashtable();
            sql = "Select * from v_PaymentBillDetail Where BuildingId = '" + buildingId + "' order by CustomerId";

            DataTable dt = DbHelper.GetDataTable(sql);
            foreach (DataRow dr in dt.Rows)
            {
                string CustomerId = dr["CustomerId"].ToString();
                string YearMonth = dr["YearMonth"].ToString();
                string key = CustomerId + "_" + YearMonth;
                DeptInfo tmp;

                if (!PaymentList.Contains(key))
                {
                    tmp = new DeptInfo();
                    tmp.CustomerId = CustomerId;
                    tmp.Customer = Func.ParseString(CusList[CustomerId]);
                    tmp.YearMonth = YearMonth;
                    PaymentList.Add(key, tmp);
                }
                string PaymentType = dr["PaymentType"].ToString();

                decimal MoneyUSD = Convert.ToDecimal(dr["MoneyUSD"]);
                decimal MoneyVND = Convert.ToDecimal(dr["MoneyVND"]);
                decimal PaidUSD = Convert.ToDecimal(dr["PaidUSD"]);
                decimal PaidVND = Convert.ToDecimal(dr["PaidVND"]);

                tmp = (DeptInfo)PaymentList[key];
                switch (PaymentType)
                {
                    case "1":
                        tmp.RentUSD = MoneyUSD;
                        tmp.RentVND = MoneyVND;
                        tmp.RentPaidUSD = PaidUSD;
                        tmp.RentPaidVND = PaidVND;
                        break;
                    case "2":
                        tmp.ManagerUSD = MoneyUSD;
                        tmp.ManagerVND = MoneyVND;
                        tmp.ManagerPaidUSD = PaidUSD;
                        tmp.ManagerPaidVND = PaidVND;
                        break;
                    case "3":
                        tmp.ParkingUSD = MoneyUSD;
                        tmp.ParkingVND = MoneyVND;
                        tmp.ParkingPaidUSD = PaidUSD;
                        tmp.ParkingPaidVND = PaidVND;
                        break;
                    case "4":
                        tmp.ExtraUSD = MoneyUSD;
                        tmp.ExtraVND = MoneyVND;
                        tmp.ExtraPaidUSD = PaidUSD;
                        tmp.ExtraPaidVND = PaidVND;
                        break;
                    case "5":
                        tmp.ElecUSD = MoneyUSD;
                        tmp.ElecVND = MoneyVND;
                        tmp.ElecPaidUSD = PaidUSD;
                        tmp.ElecPaidVND = PaidVND;
                        break;
                    case "6":
                        tmp.WaterUSD = MoneyUSD;
                        tmp.WaterVND = MoneyVND;
                        tmp.WaterPaidUSD = PaidUSD;
                        tmp.WaterPaidVND = PaidVND;
                        break;
                    case "7":
                        tmp.ServiceUSD = MoneyUSD;
                        tmp.ServiceVND = MoneyVND;
                        tmp.ServicePaidUSD = PaidUSD;
                        tmp.ServicePaidVND = PaidVND;
                        break;
                    case "8":
                        tmp.BookingUSD = MoneyUSD;
                        tmp.BookingVND = MoneyVND;
                        tmp.BookingPaidUSD = PaidUSD;
                        tmp.BookingPaidVND = PaidVND;
                        break;
                    default:
                        break;
                }
            }

            C1XLBook xlbBook = new C1XLBook();

            string fileName = HttpContext.Current.Server.MapPath(@"~\Report\Template\BaoCaoCongNo.xlsx");
            if (!Directory.Exists(@"~\Report\Building\" + Func.ParseString(Session["__BUILDINGID__"]) + @"\BaoCaoCongNo"))
            {
                Directory.CreateDirectory(HttpContext.Current.Server.MapPath(@"~\Report\Building\" + Func.ParseString(Session["__BUILDINGID__"]) + @"\BaoCaoCongNo"));
            }

            string strDT = DateTime.Now.ToString("yyyyMMddHHmmss");
            string strFilePath = @"~\Report\Building\" + Func.ParseString(Session["__BUILDINGID__"]) + @"\BaoCaoCongNo\BaoCaoCongNo" + strDT + ".xlsx";
            string strFilePathExport = "Report/Building/" + Func.ParseString(Session["__BUILDINGID__"]) + "/BaoCaoCongNo/BaoCaoCongNo" + strDT + ".xlsx";

            string fileNameDes = HttpContext.Current.Server.MapPath(strFilePath);

            //string fileNameDes = HttpContext.Current.Server.MapPath(@"~\Report\Building\" + Func.ParseString(Session["__BUILDINGID__"]) + @"\TongHopDienTich" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");
            File.Copy(fileName, fileNameDes);

            xlbBook.Load(fileNameDes);

            XLStyle xlstStyle2 = new XLStyle(xlbBook);
            xlstStyle2.AlignVert = XLAlignVertEnum.Center;
            xlstStyle2.WordWrap = false;
            xlstStyle2.Font = new Font("", 8, FontStyle.Regular);
            xlstStyle2.SetBorderColor(Color.Black);
            xlstStyle2.BorderBottom = XLLineStyleEnum.Thin;
            xlstStyle2.BorderTop = XLLineStyleEnum.Thin;
            xlstStyle2.BorderLeft = XLLineStyleEnum.Thin;
            xlstStyle2.BorderRight = XLLineStyleEnum.Thin;
            xlstStyle2.Format = "#,##0.00_);(#,##0.00)";

            XLStyle xlstStyle1 = new XLStyle(xlbBook);
            xlstStyle1.AlignVert = XLAlignVertEnum.Center;
            xlstStyle1.WordWrap = false;
            xlstStyle1.Font = new Font("", 8, FontStyle.Regular);
            xlstStyle1.SetBorderColor(Color.Black);
            xlstStyle1.BorderBottom = XLLineStyleEnum.Thin;
            xlstStyle1.BorderTop = XLLineStyleEnum.Thin;
            xlstStyle1.BorderLeft = XLLineStyleEnum.Thin;
            xlstStyle1.BorderRight = XLLineStyleEnum.Thin;
            xlstStyle1.Format = "#,##0.0_);(#,##0.0)";

            XLStyle xlstStyle0 = new XLStyle(xlbBook);
            xlstStyle0.AlignVert = XLAlignVertEnum.Center;
            xlstStyle0.WordWrap = false;
            xlstStyle0.Font = new Font("", 8, FontStyle.Regular);
            xlstStyle0.SetBorderColor(Color.Black);
            xlstStyle0.BorderBottom = XLLineStyleEnum.Thin;
            xlstStyle0.BorderTop = XLLineStyleEnum.Thin;
            xlstStyle0.BorderLeft = XLLineStyleEnum.Thin;
            xlstStyle0.BorderRight = XLLineStyleEnum.Thin;
            xlstStyle0.Format = "#,##0_);(#,##0)";

            XLStyle xlstStyleB2 = new XLStyle(xlbBook);
            xlstStyleB2.AlignHorz = XLAlignHorzEnum.Right;
            xlstStyleB2.AlignVert = XLAlignVertEnum.Center;
            xlstStyleB2.WordWrap = false;
            xlstStyleB2.Font = new Font("", 8, FontStyle.Bold);
            xlstStyleB2.SetBorderColor(Color.Black);
            xlstStyleB2.BorderBottom = XLLineStyleEnum.Thin;
            xlstStyleB2.BorderTop = XLLineStyleEnum.Thin;
            xlstStyleB2.BorderLeft = XLLineStyleEnum.Thin;
            xlstStyleB2.BorderRight = XLLineStyleEnum.Thin;
            xlstStyleB2.Format = "#,##0.00_);(#,##0.00)";

            XLStyle xlstStyleB1 = new XLStyle(xlbBook);
            xlstStyleB1.AlignHorz = XLAlignHorzEnum.Right;
            xlstStyleB1.AlignVert = XLAlignVertEnum.Center;
            xlstStyleB1.WordWrap = false;
            xlstStyleB1.Font = new Font("", 8, FontStyle.Bold);
            xlstStyleB1.SetBorderColor(Color.Black);
            xlstStyleB1.BorderBottom = XLLineStyleEnum.Thin;
            xlstStyleB1.BorderTop = XLLineStyleEnum.Thin;
            xlstStyleB1.BorderLeft = XLLineStyleEnum.Thin;
            xlstStyleB1.BorderRight = XLLineStyleEnum.Thin;
            xlstStyleB1.Format = "#,##0.0_);(#,##0.0)";

            XLStyle xlstStyleB0 = new XLStyle(xlbBook);
            xlstStyleB0.AlignHorz = XLAlignHorzEnum.Right;
            xlstStyleB0.AlignVert = XLAlignVertEnum.Center;
            xlstStyleB0.WordWrap = false;
            xlstStyleB0.Font = new Font("", 8, FontStyle.Bold);
            xlstStyleB0.SetBorderColor(Color.Black);
            xlstStyleB0.BorderBottom = XLLineStyleEnum.Thin;
            xlstStyleB0.BorderTop = XLLineStyleEnum.Thin;
            xlstStyleB0.BorderLeft = XLLineStyleEnum.Thin;
            xlstStyleB0.BorderRight = XLLineStyleEnum.Thin;
            xlstStyleB0.Format = "#,##0_);(#,##0)";

            string sheet = "BaoCao";

            XLSheet xlsSheet = xlbBook.Sheets[sheet];
            int i = 5;

            decimal[] SumUsd = { 0, 0, 0, 0, 0, 0, 0, 0, };
            decimal[] SumVnd = { 0, 0, 0, 0, 0, 0, 0, 0, };

            decimal[] AllSumUsd = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            decimal[] AllSumVnd = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            xlsSheet[0, 1].Value = xlsSheet[0, 1].Value.ToString().Replace("{%TOA_NHA%}", DbHelper.GetScalar("Select Name From Mst_Building Where BuildingId = '" + buildingId + "'"));
            int j = 1;
            foreach (DictionaryEntry tmp in PaymentList)
            {
                string key = (string)tmp.Key;
                DeptInfo dept = (DeptInfo)tmp.Value;

                xlsSheet[i, 0 + j].Value = dept.YearMonth.Substring(4, 2) + "/" + dept.YearMonth.Substring(0, 4);
                xlsSheet[i, 1 + j].Value = dept.CustomerId;
                xlsSheet[i, 2 + j].Value = dept.Customer;

                xlsSheet[i, 3 + j].Value = dept.RentDeptUSD();
                xlsSheet[i, 4 + j].Value = dept.RentDeptVND();

                xlsSheet[i, 5 + j].Value = dept.ManagerDeptUSD();
                xlsSheet[i, 6 + j].Value = dept.ManagerDeptVND();

                xlsSheet[i, 7 + j].Value = dept.ParkingDeptUSD();
                xlsSheet[i, 8 + j].Value = dept.ParkingDeptVND();

                xlsSheet[i, 9 + j].Value = dept.ExtraDeptUSD();
                xlsSheet[i, 10 + j].Value = dept.ExtraDeptVND();

                //xlsSheet[i, 11 + j].Value = dept.ElecDeptUSD();
                xlsSheet[i, 11 + j].Value = dept.ElecDeptVND();

                //xlsSheet[i, 13 + j].Value = dept.WaterDeptUSD();
                xlsSheet[i, 12 + j].Value = dept.WaterDeptVND();

                xlsSheet[i, 13 + j].Value = dept.ServiceDeptUSD();
                xlsSheet[i, 14 + j].Value = dept.ServiceDeptVND();

                xlsSheet[i, 15 + j].Value = dept.BookingDeptUSD();
                xlsSheet[i, 16 + j].Value = dept.BookingDeptVND();

                //////////////////////////
                SumUsd[0] = dept.RentDeptUSD();
                SumVnd[0] = dept.RentDeptVND();

                SumUsd[1] = dept.ManagerDeptUSD();
                SumVnd[1] = dept.ManagerDeptVND();

                SumUsd[2] = dept.ParkingDeptUSD();
                SumVnd[2] = dept.ParkingDeptVND();

                SumUsd[3] = dept.ExtraDeptUSD();
                SumVnd[3] = dept.ExtraDeptVND();

                SumVnd[4] = dept.ElecDeptVND();

                SumVnd[5] = dept.WaterDeptVND();

                SumUsd[6] = dept.ServiceDeptUSD();
                SumVnd[6] = dept.ServiceDeptVND();

                SumUsd[7] = dept.BookingDeptUSD();
                SumVnd[7] = dept.BookingDeptVND();

                xlsSheet[i, 17 + j].Value = SumUsd[0] + SumUsd[1] + SumUsd[2] + SumUsd[3] + SumUsd[4] + SumUsd[5] + SumUsd[6] + SumUsd[7];
                xlsSheet[i, 18 + j].Value = SumVnd[0] + SumVnd[1] + SumVnd[2] + SumVnd[3] + SumVnd[4] + SumVnd[5] + SumVnd[6] + SumVnd[7];
                /////////////

                AllSumUsd[0] += dept.RentDeptUSD();
                AllSumVnd[0] += dept.RentDeptVND();

                AllSumUsd[1] += dept.ManagerDeptUSD();
                AllSumVnd[1] += dept.ManagerDeptVND();

                AllSumUsd[2] += dept.ParkingDeptUSD();
                AllSumVnd[2] += dept.ParkingDeptVND();

                AllSumUsd[3] += dept.ExtraDeptUSD();
                AllSumVnd[3] += dept.ExtraDeptVND();

                AllSumVnd[4] += dept.ElecDeptVND();

                AllSumVnd[5] += dept.WaterDeptVND();

                AllSumUsd[6] += dept.ServiceDeptUSD();
                AllSumVnd[6] += dept.ServiceDeptVND();

                AllSumUsd[7] += dept.BookingDeptUSD();
                AllSumVnd[7] += dept.BookingDeptVND();

                AllSumUsd[8] += SumUsd[0] + SumUsd[1] + SumUsd[2] + SumUsd[3] + SumUsd[4] + SumUsd[5] + SumUsd[6] + SumUsd[7];
                AllSumVnd[8] += SumVnd[0] + SumVnd[1] + SumVnd[2] + SumVnd[3] + SumVnd[4] + SumVnd[5] + SumVnd[6] + SumVnd[7];
                //////////////////////////

                for (int m = 0; m < 19; m++)
                {
                    xlsSheet[i, m + j].Style = xlstStyle1;
                }

                ///////////////////////////////////////////////////
                xlsSheet[i, 4 + j].Style = xlstStyle0;
                xlsSheet[i, 6 + j].Style = xlstStyle0;
                xlsSheet[i, 8 + j].Style = xlstStyle0;
                xlsSheet[i, 10 + j].Style = xlstStyle0;
                xlsSheet[i, 11 + j].Style = xlstStyle0;
                xlsSheet[i, 12 + j].Style = xlstStyle0;
                xlsSheet[i, 14 + j].Style = xlstStyle0;
                xlsSheet[i, 16 + j].Style = xlstStyle0;
                xlsSheet[i, 18 + j].Style = xlstStyle0;
                ///////////////////////////////////////////////////
                i++;
            }
            xlsSheet[i, 3 + j].Value = AllSumUsd[0];
            xlsSheet[i, 4 + j].Value = AllSumVnd[0];

            xlsSheet[i, 5 + j].Value = AllSumUsd[1];
            xlsSheet[i, 6 + j].Value = AllSumVnd[1];

            xlsSheet[i, 7 + j].Value = AllSumUsd[2];
            xlsSheet[i, 8 + j].Value = AllSumVnd[2];

            xlsSheet[i, 9 + j].Value = AllSumUsd[3];
            xlsSheet[i, 10 + j].Value = AllSumVnd[3];

            //xlsSheet[i, 11 + j].Value = dept.ElecDeptUSD();
            xlsSheet[i, 11 + j].Value = AllSumVnd[4];

            //xlsSheet[i, 13 + j].Value = dept.WaterDeptUSD();
            xlsSheet[i, 12 + j].Value = AllSumVnd[5];

            xlsSheet[i, 13 + j].Value = AllSumUsd[6];
            xlsSheet[i, 14 + j].Value = AllSumVnd[6];

            xlsSheet[i, 15 + j].Value = AllSumUsd[7];
            xlsSheet[i, 16 + j].Value = AllSumVnd[7];

            xlsSheet[i, 17 + j].Value = AllSumUsd[8];
            xlsSheet[i, 18 + j].Value = AllSumVnd[8];

            XLCellRange mrCell = new XLCellRange(i, i, 1, 3);
            xlsSheet.MergedCells.Add(mrCell);
            xlsSheet[i, 1].Value = "Tổng Cộng";

            for (int m = 0; m < 19; m++)
            {
                xlsSheet[i, m + j].Style = xlstStyleB1;
            }
            ///////////////////////////////////////
            xlsSheet[i, 4 + j].Style = xlstStyleB0;
            xlsSheet[i, 6 + j].Style = xlstStyleB0;
            xlsSheet[i, 8 + j].Style = xlstStyleB0;
            xlsSheet[i, 10 + j].Style = xlstStyleB0;
            xlsSheet[i, 11 + j].Style = xlstStyleB0;
            xlsSheet[i, 12 + j].Style = xlstStyleB0;
            xlsSheet[i, 14 + j].Style = xlstStyleB0;
            xlsSheet[i, 16 + j].Style = xlstStyleB0;
            xlsSheet[i, 18 + j].Style = xlstStyleB0;
            ///////////////////////////////////////
            xlbBook.Save(fileNameDes);
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "", "PopUp('../" + strFilePathExport + "'," + PopupWidth + "," + PopupHeight + ",'EditReport', true);", true);
        }