Beispiel #1
0
        public ActionResult List()
        {
            #region 页面权限判断
            if (!Utits.IsLogin)
            {
                return(RedirectPermanent("../Login/Index"));
            }
            #endregion
            int[] NodePages = { ListPageNodeId };
            int   NodeId    = CommonLib.RequestParameters.Pint("NodeId");
            if (!NodePages.Contains(NodeId))
            {
                //return RedirectToAction("Index", "Error");//跳转
                return(RedirectPermanent(string.Format("../Error/Index?url={0}&msg={1}&errorrank={2}", System.Web.HttpUtility.UrlEncode(Request.Url?.ToString() ?? ""), "参数(NodeId)错误,请联系系统管理员!", EErrorRank.Error)));
            }
            if (Utits.IsNodePageAuth(NodeId).ErrorType != 1)
            {
                return(RedirectPermanent(string.Format("../Error/Index?url={0}&msg={1}&errorrank={2}", System.Web.HttpUtility.UrlEncode(Request.Url?.ToString() ?? ""), "您没有该页面的访问权限!", EErrorRank.Error)));
            }
            ViewBag.AddPageNodeId    = AddPageNodeId;
            ViewBag.EditPageNodeId   = EditPageNodeId;
            ViewBag.DetailPageNodeId = DetailPageNodeId;
            ViewBag.OperateButton    = Utits.AuthOperateButton();

            ViewBag.DetailsOperateButton = Utits.AuthOperateButton(AddPageNodeId);
            //新增字段的字典
            ViewBag.GetCustomerYSLX  = GetDictionary((int)EDictionaryType.YinShiType);      //饮食类型
            ViewBag.GetCustomerHLMC  = GetNursingRank();                                    //护理名称
            ViewBag.GetCustomerType  = GetDictionary((int)EDictionaryType.OldManType);      //老人类型
            ViewBag.GetCustomerWHCD  = GetDictionary((int)EDictionaryType.EducationType);   //老人文化程度
            ViewBag.GetCustomerDlrGx = GetDictionaryByStr((int)EDictionaryType.Kinship);    //代理人与老人关系
            ViewBag.GetCustomerHjd   = GetDictionaryByStr((int)EDictionaryType.StreetType); //户籍地

            ViewBag.GetOrgID = GetOrgID();
            return(View());
        }
Beispiel #2
0
        public JsonResult SearchList()
        {
            #region 权限控制
            int[] iRangePage         = { ListPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            var   tempAuth           = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId);
            if (tempAuth.ErrorType != 1)
            {
                return(Json(tempAuth));
            }
            #endregion

            //当前页
            int iCurrentPage = RequestParameters.Pint("currentPage");
            iCurrentPage = iCurrentPage <= 0 ? 1 : iCurrentPage;
            //索引页
            int iPageIndex = iCurrentPage - 1;
            //一页的数量
            int iPageSize = RequestParameters.Pint("pageSize");
            iPageSize = iPageSize <= 0 ? 5 : iPageSize;
            iPageSize = iPageSize > 100 ? 100 : iPageSize;
            //总记录数量
            int iTotalRecord = 0;

            #region 查询条件
            var searchCondition = new ConditionModel();

            var  WhereList       = new List <WhereCondition>();
            Guid welfareCentreId = Utits.WelfareCentreID;
            if (welfareCentreId != Guid.Empty)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "WelfareCentreID";
                whereCondition.FieldValue    = welfareCentreId;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            string Name = RequestParameters.Pstring("Name");
            if (Name.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "DeptName";
                whereCondition.FieldValue    = Name;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }
            int?IsValid = RequestParameters.PintNull("IsValid");
            if (IsValid != null)
            {
                if (IsValid == 1)
                {
                    var whereCondition = new WhereCondition();
                    whereCondition.FieldName     = "IsValid";
                    whereCondition.FieldValue    = IsValid;
                    whereCondition.FieldOperator = EnumOper.Equal;
                    WhereList.Add(whereCondition);
                }
                else
                {
                    var whereCondition = new WhereCondition();
                    whereCondition.FieldName     = "IsValid";
                    whereCondition.FieldValue    = 1;
                    whereCondition.FieldOperator = EnumOper.ExclamationEqual;
                    WhereList.Add(whereCondition);
                }
            }
            searchCondition.WhereList = WhereList;

            var    OrderList = new List <OrderCondition>();
            string sortfield = RequestParameters.Pstring("sortfield");
            if (sortfield.Length <= 0)
            {
                sortfield = "OperateDate";
            }
            var orderCondition = new OrderCondition();
            orderCondition.FiledOrder = sortfield;
            orderCondition.Ascending  = RequestParameters.Pstring("sorttype") == "asc" ? true : false;
            OrderList.Add(orderCondition);

            searchCondition.OrderList = OrderList;
            #endregion

            var cBll = new DeptsBll();
            var list = cBll.SearchByPageCondition(iPageIndex, iPageSize, ref iTotalRecord, searchCondition);
            iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize;
            int pageCount    = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1;
            var sReturnModel = new ResultList();
            sReturnModel.ErrorType   = 1;
            sReturnModel.CurrentPage = iCurrentPage;
            sReturnModel.PageSize    = iPageSize;
            sReturnModel.TotalRecord = iTotalRecord;
            sReturnModel.PageCount   = pageCount;
            sReturnModel.Data        = list;
            return(Json(sReturnModel));
        }
Beispiel #3
0
        public JsonResult ListOperateStatus()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            int[] iRangeButton       = { (int)EButtonType.Delete, (int)EButtonType.Enable, (int)EButtonType.Disable };
            int   iCurrentButtonId   = RequestParameters.Pint("oButtonId");
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iRangeButton, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            //注释时间 20190306 林中枝
            //后期多条删除数据时  酌情修改
            //string _ids = RequestParameters.Pstring("ids");
            //if (string.IsNullOrEmpty(_ids))
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);
            //}
            //string[] strids = _ids.Split(',');
            //System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            //for (int i = 0; i < strids.Length; i++)
            //{
            //    if (RegexValidate.IsGuid(strids[i]))
            //    {
            //        arrayList.Add(strids[i]);
            //    }
            //}
            //string[] ids = (string[])arrayList.ToArray(typeof(string));
            //if (!ids.Any())
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);
            //}
            Guid ID = RequestParameters.PGuid("ids");
            if (ID == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var  cBll   = new DeptsBll();
            bool isFlag = false;
            switch (iCurrentButtonId)
            {
            case (int)EButtonType.Delete:    //删除
                ParamState = "3";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Deleted);
                break;

            case (int)EButtonType.Enable:    //启用
                ParamState = "5";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Valid);
                break;

            case (int)EButtonType.Disable:    //禁用
                ParamState = "6";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Forbidden);
                break;
            }
            if (isFlag)
            {
                ParamID = ID.ToString();
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
Beispiel #4
0
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.Save;


            var tempNoAuth = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            #region AddOrUpdate
            Guid     ID              = RequestParameters.PGuid("ID");
            Guid     ddlOrgID        = RequestParameters.PGuid("ddlOrgID");
            string   CustomerName    = RequestParameters.Pstring("CustomerName");
            int      Age             = RequestParameters.Pint("Age");
            int      CustomerGender  = RequestParameters.Pint("CustomerGender");
            string   CustomerWedlock = RequestParameters.Pstring("CustomerWedlock");
            string   CustomerJG      = RequestParameters.Pstring("CustomerJG");
            string   Address         = RequestParameters.Pstring("Address");
            string   Company         = RequestParameters.Pstring("Company");
            string   Phone           = RequestParameters.Pstring("Phone");
            string   CustomerGSR     = RequestParameters.Pstring("CustomerGSR");
            DateTime?AdmissionDate   = RequestParameters.PDateTime("AdmissionDate");
            DateTime?DiagnosticDate  = RequestParameters.PDateTime("DiagnosticDate");

            string   CustomerJJYW     = RequestParameters.Pstring("CustomerJJYW");
            string   CustomerJJSW     = RequestParameters.Pstring("CustomerJJSW");
            int?     CustomerYSLX_dic = RequestParameters.PintNull("CustomerYSLX_dic");
            string   CustomerYYBH     = RequestParameters.Pstring("CustomerYYBH");
            string   CustomerSFWWYY   = RequestParameters.Pstring("CustomerSFWWYY");
            int?     CustomerHLMC_dic = RequestParameters.PintNull("CustomerHLMC_dic");
            string   CustomerCardID   = RequestParameters.Pstring("CustomerCardID");
            int?     CustomerType_dic = RequestParameters.PintNull("CustomerType_dic");
            string   CustomerSBKH     = RequestParameters.Pstring("CustomerSBKH");
            string   CustomerMZ       = RequestParameters.Pstring("CustomerMZ");
            int?     CustomerWHCD_dic = RequestParameters.PintNull("CustomerWHCD_dic");
            string   CustomerZW       = RequestParameters.Pstring("CustomerZW");
            int      CustomerYLJSR    = RequestParameters.Pint("CustomerYLJSR");
            string   CustomerZZDH     = RequestParameters.Pstring("CustomerZZDH");
            string   CustomerYYZT     = RequestParameters.Pstring("CustomerYYZT");
            string   CustomerSFBS     = RequestParameters.Pstring("CustomerSFBS");
            string   CustomerSX       = RequestParameters.Pstring("CustomerSX");
            string   CustomerZYBH     = RequestParameters.Pstring("CustomerZYBH");
            DateTime?CustomerYYSJ     = RequestParameters.PDateTime("CustomerYYSJ");
            DateTime?CustomerLYSJ     = RequestParameters.PDateTime("CustomerLYSJ");
            string   CustomerLYYY     = RequestParameters.Pstring("CustomerLYYY");
            string   CustomerYLBZ     = RequestParameters.Pstring("CustomerYLBZ");
            string   CustomerXMPY     = GetSpellCode(CustomerName);
            DateTime?CustomerBrith    = RequestParameters.PDateTime("CustomerBrith");
            Guid     oldBednoID       = RequestParameters.PGuid("oldBednoID");
            Guid     bednoID          = RequestParameters.PGuid("bednoID");
            string   BedNumberName    = RequestParameters.Pstring("BedNumberName");
            string   bednoText        = RequestParameters.Pstring("bednoText");
            string   HeadImg          = RequestParameters.Pstring("HeadImg");

            string CustomerZZMM        = RequestParameters.Pstring("CustomerZZMM");
            string CustomerJYCD        = RequestParameters.Pstring("CustomerJYCD");
            string CustomerDlrXm       = RequestParameters.Pstring("CustomerDlrXm");
            string CustomerDlrTel      = RequestParameters.Pstring("CustomerDlrTel");
            string CustomerDlrDz       = RequestParameters.Pstring("CustomerDlrDz");
            string CustomerDlrGx       = RequestParameters.Pstring("CustomerDlrGx");
            string CustomerDlrYb       = RequestParameters.Pstring("CustomerDlrYb");
            string ddlCustomerHJDQ_dic = RequestParameters.Pstring("CustomerHJDQ_dic");
            var    cBll = new CustomerBll();
            #region  判断
            if (CustomerName.Length <= 0)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "姓名不能为空.";
                return(Json(sRetrunModel));
            }
            //var welfareCentreId = Utits.WelfareCentreID;
            //if (bednoID != Guid.Empty)
            //{
            //    bool isFlagValidation = false;
            //    if (ID == Guid.Empty)
            //        isFlagValidation = cBll.ValidationBedByCustomer(bednoID, welfareCentreId);
            //    else
            //        isFlagValidation = cBll.ValidationBedByCustomer(ID, bednoID, welfareCentreId);

            //    if (!isFlagValidation)
            //    {
            //        var sRetrunModel = new ResultMessage();
            //        sRetrunModel.ErrorType = 0;
            //        sRetrunModel.MessageContent = "床位已住人.";
            //        return Json(sRetrunModel);
            //    }
            //}
            #endregion

            var item = new tbCustomer();
            item.ID = ID;

            ParamState = "1";
            ParamID    = item.ID.ToString();

            item.Stage           = (int)ECustomerType.RuYuan;
            item.OperateDate     = DateTime.Now;
            item.CustomerName    = CustomerName;
            item.BedNumber       = bednoID == Guid.Empty ? "" : bednoText;
            item.BedID           = bednoID;
            item.CustomerGender  = CustomerGender;
            item.CustomerWedlock = CustomerWedlock;
            item.CustomerAge     = Age;
            item.CustomerJG      = CustomerJG;
            item.CustomerAddress = Address;
            item.CustomerCompany = Company;
            item.CustomerTel     = Phone;
            item.CustomerGSR     = CustomerGSR;
            item.AdmissionDate   = AdmissionDate ?? DateTime.Now;
            item.DiagnosticDate  = DiagnosticDate ?? DateTime.Now;

            item.CustomerCardID   = CustomerCardID;
            item.CustomerType_dic = CustomerType_dic;
            item.CustomerSBKH     = CustomerSBKH;
            item.CustomerMZ       = CustomerMZ;
            item.CustomerWHCD_dic = CustomerWHCD_dic;
            item.CustomerZW       = CustomerZW;
            item.CustomerYLJSR    = CustomerYLJSR;
            item.CustomerZZDH     = CustomerZZDH;
            item.CustomerYYZT     = CustomerYYZT;
            item.CustomerSFBS     = CustomerSFBS;
            item.CustomerSX       = CustomerSX;
            item.CustomerXMPY     = CustomerXMPY;//姓名拼音
            item.CustomerZYBH     = CustomerZYBH;
            item.CustomerYYSJ     = CustomerYYSJ;
            item.CustomerLYSJ     = CustomerLYSJ;
            item.CustomerLYYY     = CustomerLYYY;
            item.CustomerYLBZ     = CustomerYLBZ;
            item.CustomerJJYW     = CustomerJJYW;
            item.CustomerJJSW     = CustomerJJSW;
            item.CustomerYSLX_dic = CustomerYSLX_dic;
            item.CustomerYYBH     = CustomerYYBH;
            item.CustomerSFWWYY   = CustomerSFWWYY;
            item.CustomerHLMC_dic = CustomerHLMC_dic;
            item.CustomerBrith    = CustomerBrith;
            item.BedNumberName    = BedNumberName;
            item.CustomerHeadImg  = HeadImg;

            item.CustomerZZMM     = CustomerZZMM;
            item.CustomerJYCD     = CustomerJYCD;
            item.CustomerDlrXm    = CustomerDlrXm;
            item.CustomerDlrTel   = CustomerDlrTel;
            item.CustomerDlrDz    = CustomerDlrDz;
            item.CustomerDlrGx    = CustomerDlrGx;
            item.CustomerDlrYb    = CustomerDlrYb;
            item.CustomerHJDQ_dic = ddlCustomerHJDQ_dic;
            //item.WelfareCentreID = welfareCentreId;
            item.WelfareCentreID = ddlOrgID;
            bool IsFlag = cBll.AddOrUpdate(item, oldBednoID);
            //if (bednoID != oldBednoID)
            //{
            //    //BedStatus 1 有人住,0 没人住
            //    if (bednoID!=Guid.Empty)
            //    {
            //        var bedBll = new BedBll();
            //        bool IsBedFlag = bedBll.OperateBedStatus(bednoID,1);
            //    }
            //    if (oldBednoID != Guid.Empty)
            //    {
            //        var bedBll = new BedBll();
            //        bool IsBedFlag = bedBll.OperateBedStatus(oldBednoID, 0);
            //    }
            //}
            if (IsFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
            #endregion
        }
Beispiel #5
0
        public JsonResult ListPhyDelOld()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.PhyDelete;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            string _ids = RequestParameters.Pstring("ids");
            if (string.IsNullOrEmpty(_ids))
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string[] strids = _ids.Split(',');
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < strids.Length; i++)
            {
                if (RegexValidate.IsGuid(strids[i]))
                {
                    arrayList.Add(strids[i]);
                }
            }
            string[] ids = (string[])arrayList.ToArray(typeof(string));
            if (!ids.Any())
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string   _bedIds   = RequestParameters.Pstring("bedIds");
            string[] strbedIds = _bedIds.Split(',');
            System.Collections.ArrayList arrayBedIdList = new System.Collections.ArrayList();
            for (int i = 0; i < strbedIds.Length; i++)
            {
                if (RegexValidate.IsGuid(strbedIds[i]))
                {
                    ParamID += strids[i] + ",";
                    arrayBedIdList.Add(strbedIds[i]);
                }
            }
            string[] bedIds          = (string[])arrayBedIdList.ToArray(typeof(string));
            var      welfareCentreId = Utits.WelfareCentreID;
            var      cBll            = new CustomerBll();
            bool     isFlag          = cBll.PhysicalDeleteByCondition(ids);
            if (isFlag)
            {
                ////BedStatus 1 有人住,0 没人住
                //var bedBll = new BedBll();
                //bedBll.OperateBedStatus(bedIds, 0, welfareCentreId);

                ParamState = "4";
                var cLog = new LogsBll();
                cLog.Log(ParamID.TrimEnd(','), ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
Beispiel #6
0
        public JsonResult ListOperateStatus()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int[] iRangeButton       = { (int)EButtonType.CustomerLeave, (int)EButtonType.Enable, (int)EButtonType.Disable };
            int   iCurrentButtonId   = RequestParameters.Pint("oButtonId");
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iRangeButton, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            var customerId = RequestParameters.PGuid("ids");
            if (customerId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var bedId = RequestParameters.PGuid("bedIds");
            if (bedId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var welfareCentreId = Utits.WelfareCentreID;

            var  cBll   = new CustomerBll();
            bool isFlag = false;
            switch (iCurrentButtonId)
            {
            case (int)EButtonType.CustomerLeave:    //删除
                ParamState = "3";
                isFlag     = cBll.OperateDataStatus(customerId, bedId, welfareCentreId, (int)ESystemStatus.Deleted);
                break;

            case (int)EButtonType.Enable:    //启用
                ParamState = "5";
                isFlag     = cBll.OperateDataStatus(customerId, bedId, welfareCentreId, (int)ESystemStatus.Valid);
                break;

            case (int)EButtonType.Disable:    //禁用
                ParamState = "6";
                isFlag     = cBll.OperateDataStatus(customerId, bedId, welfareCentreId, (int)ESystemStatus.Forbidden);
                break;
            }
            if (isFlag)
            {
                ParamID = customerId.ToString();
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.Save;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            Guid id             = RequestParameters.PGuid("ID");
            Guid ddlOrgID       = RequestParameters.PGuid("ddlOrgID");
            var  StaffName      = RequestParameters.Pstring("StaffName");
            var  StaffGender    = RequestParameters.Pint("StaffGender");
            var  EmployType     = RequestParameters.Pstring("EmployType");
            var  SocialSecurity = RequestParameters.Pstring("SocialSecurity");
            var  Profession     = RequestParameters.Pstring("Profession");
            var  WeiJi          = RequestParameters.Pstring("WeiJi");
            var  SheGong        = RequestParameters.Pstring("SheGong");
            var  QiTa           = RequestParameters.Pstring("QiTa");
            var  HgChiZheng     = RequestParameters.Pstring("HgChiZheng");
            var  HgXueLi        = RequestParameters.Pstring("HgXueLi");
            var  HgNianLing     = RequestParameters.Pstring("HgNianLing");
            var  HgRuZhiNian    = RequestParameters.Pstring("HgRuZhiNian");
            var  HgHuJi         = RequestParameters.Pstring("HgHuJi");
            var  HouQin         = RequestParameters.Pstring("HouQin");
            var  Phone          = RequestParameters.Pstring("Phone");
            var  AddressPlace   = RequestParameters.Pstring("AddressPlace");

            var item = new tbOrgTLJGCongYe();
            item.ID             = id;
            item.OperateDate    = DateTime.Now;
            item.OperateUserID  = Utits.CurrentUserID;
            item.OrganizationId = ddlOrgID;
            item.WelfareId      = ddlOrgID;

            item.StaffName      = StaffName;
            item.StaffGender    = StaffGender;
            item.EmployType     = EmployType;
            item.SocialSecurity = SocialSecurity;
            item.Profession     = Profession;
            item.WeiJi          = WeiJi;
            item.SheGong        = SheGong;
            item.QiTa           = QiTa;
            item.HgChiZheng     = HgChiZheng;
            item.HgXueLi        = HgXueLi;
            item.HgNianLing     = HgNianLing;
            item.HgRuZhiNian    = HgRuZhiNian;
            item.HgHuJi         = HgHuJi;
            item.HouQin         = HouQin;

            item.Phone        = Phone;
            item.AddressPlace = AddressPlace;

            if (item.ID == Guid.Empty)
            {
                ParamState = "1";
                ParamID    = id.ToString();
            }
            else
            {
                ParamState = "2";
                ParamID    = id.ToString();
            }
            var cBll   = new OrgTLJGCongYeBll();
            var isFlag = cBll.AddOrUpdate(item);

            if (isFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
Beispiel #8
0
        public JsonResult SearchList()
        {
            #region 权限控制
            int[] iRangePage         = { ListPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            var   tempAuth           = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId);
            if (tempAuth.ErrorType != 1)
            {
                return(Json(tempAuth));
            }
            #endregion

            //当前页
            int iCurrentPage = RequestParameters.Pint("currentPage");
            iCurrentPage = iCurrentPage <= 0 ? 1 : iCurrentPage;
            //索引页
            int iPageIndex = iCurrentPage - 1;
            //一页的数量
            int iPageSize = RequestParameters.Pint("pageSize");
            iPageSize = iPageSize <= 0 ? 5 : iPageSize;
            iPageSize = iPageSize > 100 ? 100 : iPageSize;
            //总记录数量
            int iTotalRecord = 0;

            #region 查询条件
            var searchCondition = new ConditionModel();

            var WhereList = new List <WhereCondition>();

            int[] Stage = { (int)ECustomerType.Rzspb, (int)ECustomerType.RuYuan };
            for (int i = 0; i < Stage.Length; i++)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "Stage";
                whereCondition.FieldValue    = Stage[i];
                whereCondition.Relation      = "OR";
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            string CustomerName = RequestParameters.Pstring("CustomerName");
            if (CustomerName.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "CustomerName";
                whereCondition.FieldValue    = CustomerName;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }
            var welfareCentreId = Utits.WelfareCentreID;
            if (welfareCentreId != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "WelfareCentreID";
                whereCondition.FieldValue    = welfareCentreId;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            Guid userId = RequestParameters.PGuid("userId");
            if (userId != Guid.Empty)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "OperatorUserID";
                whereCondition.FieldValue    = userId;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            var CustomerGender = RequestParameters.PintNull("CustomerGender");//性别
            if (CustomerGender != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "CustomerGender";
                whereCondition.FieldValue    = CustomerGender;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            var CustomerHJDQBySearch = RequestParameters.Pstring("CustomerHJDQBySearch");//
            if (CustomerHJDQBySearch.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "CustomerHJDQ_dic";
                whereCondition.FieldValue    = CustomerHJDQBySearch;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            var AgeBySearch = RequestParameters.Pstring("AgeBySearch");
            if (AgeBySearch.Length > 0)
            {
                var ageList = AgeBySearch.Split('-');
                if (ageList.Count() == 2)
                {
                    if (ageList[0] != null)
                    {
                        var whereCondition = new WhereCondition();
                        whereCondition.FieldName     = "CustomerAge";
                        whereCondition.FieldValue    = ageList[0];
                        whereCondition.FieldOperator = EnumOper.GreaterThanEqual;
                        WhereList.Add(whereCondition);
                    }
                    if (ageList[1] != null)
                    {
                        var whereCondition = new WhereCondition();
                        whereCondition.FieldName     = "CustomerAge";
                        whereCondition.FieldValue    = ageList[1];
                        whereCondition.FieldOperator = EnumOper.LessThanEqual;
                        WhereList.Add(whereCondition);
                    }
                }
            }


            int?IsValid = RequestParameters.PintNull("IsValid");
            if (IsValid != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "IsValid";
                whereCondition.FieldValue    = IsValid;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            string Remark = RequestParameters.Pstring("RemarkBySearch");
            if (Remark.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "Remark";
                whereCondition.FieldValue    = Remark;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }

            Guid CustomerID = RequestParameters.PGuid("CustomerID");
            if (CustomerID != Guid.Empty)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "ID";
                whereCondition.FieldValue    = CustomerID;
                whereCondition.FieldOperator = EnumOper.DoubleEqual;
                WhereList.Add(whereCondition);
            }
            searchCondition.WhereList = WhereList;

            var    OrderList = new List <OrderCondition>();
            string sortfield = RequestParameters.Pstring("sortfield");
            if (sortfield.Length <= 0)
            {
                sortfield = "ID";
            }
            var orderCondition = new OrderCondition();
            orderCondition.FiledOrder = sortfield;
            orderCondition.Ascending  = true;
            OrderList.Add(orderCondition);

            searchCondition.OrderList = OrderList;
            #endregion

            var cBll = new CustomerBll();
            var list = cBll.SearchVByPageCondition(iPageIndex, iPageSize, ref iTotalRecord, searchCondition);
            iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize;
            int pageCount    = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1;
            var sReturnModel = new ResultList();
            sReturnModel.ErrorType   = 1;
            sReturnModel.CurrentPage = iCurrentPage;
            sReturnModel.PageSize    = iPageSize;
            sReturnModel.TotalRecord = iTotalRecord;
            sReturnModel.PageCount   = pageCount;
            sReturnModel.Data        = list;
            return(Json(sReturnModel, JsonRequestBehavior.AllowGet));
        }
        public JsonResult ListOperateStatus()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int[] iRangeButton       = { (int)EButtonType.Delete, (int)EButtonType.Enable, (int)EButtonType.Disable };
            int   iCurrentButtonId   = RequestParameters.Pint("oButtonId");
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iRangeButton, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            string _ids = RequestParameters.Pstring("ids");
            if (string.IsNullOrEmpty(_ids))
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string[] strids = _ids.Split(',');
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < strids.Length; i++)
            {
                if (RegexValidate.IsGuid(strids[i]))
                {
                    ParamID += strids[i] + ",";
                    arrayList.Add(strids[i]);
                }
            }
            string[] ids = (string[])arrayList.ToArray(typeof(string));
            if (!ids.Any())
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string   _bedIds   = RequestParameters.Pstring("bedIds");
            string[] strbedIds = _bedIds.Split(',');
            System.Collections.ArrayList arrayBedIdList = new System.Collections.ArrayList();
            for (int i = 0; i < strbedIds.Length; i++)
            {
                if (RegexValidate.IsGuid(strbedIds[i]))
                {
                    arrayBedIdList.Add(strbedIds[i]);
                }
            }
            string[] bedIds = (string[])arrayBedIdList.ToArray(typeof(string));

            var  cBll   = new OrgTLJGCongYeBll();
            bool isFlag = false;
            switch (iCurrentButtonId)
            {
            case (int)EButtonType.Delete:    //删除
                ParamState = "3";
                isFlag     = cBll.LogicDeleteByCondition(ids);
                break;

            case (int)EButtonType.Enable:    //启用
                ParamState = "5";
                isFlag     = cBll.EnableByCodeition(ids);
                break;

            case (int)EButtonType.Disable:    //禁用
                ParamState = "6";
                isFlag     = cBll.DisableByCodeition(ids);
                break;
            }
            if (isFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID.TrimEnd(','), ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
Beispiel #10
0
        //导出报表
        public JsonResult ExportReport()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            int   iCurrentButtonId   = (int)EButtonType.Export;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion
            #region 查询条件
            var searchCondition = new ConditionModel();

            var    WhereList = new List <WhereCondition>();
            string UserName  = RequestParameters.Pstring("UserName");
            if (UserName.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "UserName";
                whereCondition.FieldValue    = UserName;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }

            string RealName = RequestParameters.Pstring("RealName");
            if (RealName.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "RealName";
                whereCondition.FieldValue    = RealName;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }
            Guid?RoleID = RequestParameters.PGuidNull("RoleID");
            if (RoleID != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "RoleID";
                whereCondition.FieldValue    = RoleID.Value;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }

            Guid?DeptID = RequestParameters.PGuidNull("DeptID");
            if (DeptID != null)
            {
                //List<Guid?> ids_guid=new List<Guid?>(){DeptID,Guid.NewGuid()};
                //string[] ids_guid = {DeptID.ToString(),Guid.NewGuid().ToString()};
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "DeptID";
                whereCondition.FieldValue    = DeptID;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }

            int?IsValid = RequestParameters.PintNull("IsValid");
            if (IsValid != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "IsValid";
                whereCondition.FieldValue    = IsValid;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            searchCondition.WhereList = WhereList;

            var    OrderList = new List <OrderCondition>();
            string sortfield = RequestParameters.Pstring("sortfield");
            if (sortfield.Length <= 0)
            {
                sortfield = "OperateDate";
            }
            var orderCondition = new OrderCondition();
            orderCondition.FiledOrder = sortfield;
            orderCondition.Ascending  = RequestParameters.Pstring("sorttype") == "asc" ? true : false;
            OrderList.Add(orderCondition);

            searchCondition.OrderList = OrderList;
            #endregion
            var cBll         = new UsersBll();
            int iTotalRecord = 0;
            var searchList   = cBll.SearchVByPageCondition(0, 65536, ref iTotalRecord, searchCondition);

            if (searchList == null || searchList.Count == 0)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败:无导出数据.";
                return(Json(sRetrunModel));
            }
            try
            {
                string fileName = "用户信息导出" + DateTime.Now.ToString("yyyyMMMMddHHmmss") + ".xls";
                string fileUrl  = Server.MapPath("~/Upload") + "/temp/";
                if (!Directory.Exists(fileUrl))
                {
                    Directory.CreateDirectory(fileUrl);
                }
                var filePath = fileUrl + fileName;

                const int    rowHeight = 20;
                const int    colCount  = 9; //导出数据的总列数
                HSSFWorkbook workbook  = new HSSFWorkbook();
                ISheet       sheet1    = workbook.CreateSheet("Sheet1");
                #region 对齐格式
                //左对齐格式
                ICellStyle styleLeft = workbook.CreateCellStyle();
                styleLeft.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Left;
                styleLeft.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
                styleLeft.BorderBottom      = NPOI.SS.UserModel.BorderStyle.Thin;
                styleLeft.BorderLeft        = NPOI.SS.UserModel.BorderStyle.Thin;
                styleLeft.BorderRight       = NPOI.SS.UserModel.BorderStyle.Thin;
                styleLeft.BorderTop         = NPOI.SS.UserModel.BorderStyle.Thin;
                //右对齐格式
                ICellStyle styleRight = workbook.CreateCellStyle();
                styleRight.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Right;
                styleRight.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
                styleRight.BorderBottom      = NPOI.SS.UserModel.BorderStyle.Thin;
                styleRight.BorderLeft        = NPOI.SS.UserModel.BorderStyle.Thin;
                styleRight.BorderRight       = NPOI.SS.UserModel.BorderStyle.Thin;
                styleRight.BorderTop         = NPOI.SS.UserModel.BorderStyle.Thin;
                //居中对齐格式
                ICellStyle styleCenter = workbook.CreateCellStyle();
                styleCenter.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Center;
                styleCenter.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
                styleCenter.BorderBottom      = NPOI.SS.UserModel.BorderStyle.Thin;
                styleCenter.BorderLeft        = NPOI.SS.UserModel.BorderStyle.Thin;
                styleCenter.BorderRight       = NPOI.SS.UserModel.BorderStyle.Thin;
                styleCenter.BorderTop         = NPOI.SS.UserModel.BorderStyle.Thin;
                #endregion
                #region 标题和表头
                //标题
                ICellStyle styleTitle = workbook.CreateCellStyle();
                styleTitle.Alignment         = HorizontalAlignment.Center;
                styleTitle.VerticalAlignment = VerticalAlignment.Center;
                styleTitle.BorderBottom      = NPOI.SS.UserModel.BorderStyle.Thin;
                styleTitle.BorderLeft        = NPOI.SS.UserModel.BorderStyle.Thin;
                styleTitle.BorderRight       = NPOI.SS.UserModel.BorderStyle.Thin;
                styleTitle.BorderTop         = NPOI.SS.UserModel.BorderStyle.Thin;
                var fontTitle = workbook.CreateFont();
                fontTitle.FontHeightInPoints = 16;
                fontTitle.Boldweight         = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
                fontTitle.FontName           = "微软雅黑";
                styleTitle.SetFont(fontTitle);
                //表头
                ICellStyle styleTh = workbook.CreateCellStyle();
                styleTh.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Center;
                styleTh.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
                styleTh.BorderBottom      = NPOI.SS.UserModel.BorderStyle.Thin;
                styleTh.BorderLeft        = NPOI.SS.UserModel.BorderStyle.Thin;
                styleTh.BorderRight       = NPOI.SS.UserModel.BorderStyle.Thin;
                styleTh.BorderTop         = NPOI.SS.UserModel.BorderStyle.Thin;
                var fontTh = workbook.CreateFont();
                fontTh.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
                styleTh.SetFont(fontTh);
                #endregion

                IRow row1 = sheet1.CreateRow(0);
                row1.HeightInPoints = rowHeight;
                //CellRangeAddress(int, int, int, int)
                //参数:起始行号,终止行号, 起始列号,终止列号
                sheet1.AddMergedRegion(new CellRangeAddress(0, 0, 0, colCount - 1));
                row1.CreateCell(0).SetCellValue("用户信息");
                row1.GetCell(0).CellStyle = styleCenter;

                IRow row2 = sheet1.CreateRow(1);
                row2.HeightInPoints = rowHeight;

                #region 创建表头
                row2.CreateCell(0).SetCellValue("序号");
                row2.CreateCell(1).SetCellValue("用户编号");
                row2.CreateCell(2).SetCellValue("用户名称");
                row2.CreateCell(3).SetCellValue("角色名称");
                row2.CreateCell(4).SetCellValue("部门名称");
                row2.CreateCell(5).SetCellValue("真实姓名");
                row2.CreateCell(6).SetCellValue("操作时间");
                row2.CreateCell(7).SetCellValue("状态");
                row2.CreateCell(8).SetCellValue("备注");
                for (int i = 0; i < colCount; i++)
                {
                    row2.GetCell(i).CellStyle = styleTh;
                }
                #endregion

                int  rowNumber = 2;//行号索引
                IRow row;
                foreach (var item in searchList)
                {
                    row = sheet1.CreateRow(rowNumber);
                    row.HeightInPoints = rowHeight;
                    row.CreateCell(0).SetCellValue(rowNumber - 1);
                    row.GetCell(0).CellStyle = styleCenter;

                    row.CreateCell(1).SetCellValue(item.UserCode);
                    row.GetCell(1).CellStyle = styleLeft;

                    row.CreateCell(2).SetCellValue(item.UserName);
                    row.GetCell(2).CellStyle = styleLeft;

                    row.CreateCell(3).SetCellValue(item.RoleName);
                    row.GetCell(3).CellStyle = styleLeft;

                    row.CreateCell(4).SetCellValue(item.DeptName);
                    row.GetCell(4).CellStyle = styleLeft;

                    row.CreateCell(5).SetCellValue(item.RealName);
                    row.GetCell(5).CellStyle = styleLeft;

                    row.CreateCell(6).SetCellValue(item.OperateDate == null ? "" : item.OperateDate.Value.ToString("yyyy-MM-dd HH:mm"));
                    row.GetCell(6).CellStyle = styleLeft;

                    row.CreateCell(7).SetCellValue(item.IsValid == 1 ? "有效" : "无效");
                    row.GetCell(7).CellStyle = styleLeft;

                    row.CreateCell(8).SetCellValue(item.Remark);
                    row.GetCell(8).CellStyle = styleLeft;
                    rowNumber++;
                }
                for (int i = 0; i < colCount; i++)
                {
                    sheet1.AutoSizeColumn(i);
                }
                using (var file = new MemoryStream())
                {
                    workbook.Write(file);
                    using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
                    {
                        byte[] data = file.ToArray();
                        fs.Write(data, 0, data.Length);
                        fs.Flush();
                    }
                }
                var sRetrunModel = new ResultMessage
                {
                    ErrorType      = 1,
                    MessageContent = fileName
                };
                return(Json(sRetrunModel));
            }
            catch (Exception ex)
            {
                MessageLog.WriteLog(new LogParameterModel
                {
                    LogLevel  = ELogLevel.Error,
                    Title     = "导出数据",
                    Message   = ex.Message,
                    ClassName = this.GetType().FullName
                });
                var exRetrunModel = new ResultMessage
                {
                    ErrorType      = 0,
                    MessageContent = "操作失败:系统性异常."
                };
                return(Json(exRetrunModel));
            }
        }
Beispiel #11
0
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            bool  isAdd            = iCurrentPageNodeId == AddPageNodeId ? true : false;
            int   iCurrentButtonId = (int)EButtonType.Save;
            var   tempNoAuth       = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            #region AddOrUpdate
            var    welfareCentreId = Utits.WelfareCentreID;
            string UserCode        = RequestParameters.Pstring("UserCode");
            string UserName        = RequestParameters.Pstring("UserName");
            string RealName        = RequestParameters.Pstring("RealName");
            string Password        = RequestParameters.Pstring("Password");
            Guid   DeptId          = RequestParameters.PGuid("DeptId");
            Guid   RoleId          = RequestParameters.PGuid("RoleId");
            int    UserType        = RequestParameters.Pint("UserType");
            string Remark          = RequestParameters.Pstring("Remark");
            string IcCardNO        = RequestParameters.Pstring("IcCardNO");
            if (UserName.Length <= 0)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "用户名不能为空.";
                return(Json(sRetrunModel));
            }
            var  cBll             = new UsersBll();
            Guid ID               = RequestParameters.PGuid("ID");
            bool isFlagValidation = false;
            if (ID == Guid.Empty)
            {
                isFlagValidation = cBll.ValidationUserName(UserName, welfareCentreId);
            }
            else
            {
                isFlagValidation = cBll.ValidationUserName(ID, UserName, welfareCentreId);
            }


            if (!isFlagValidation)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "用户名已存在.";
                return(Json(sRetrunModel));
            }

            if (RealName.Length <= 0)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "真实姓名不能为空.";
                return(Json(sRetrunModel));
            }
            if (DeptId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "部门参数错误,请返回列表页面重新操作.";
                return(Json(sRetrunModel));
            }
            if (RoleId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "角色参数错误,请返回列表页面重新操作.";
                return(Json(sRetrunModel));
            }

            var item = new Users();
            if (ID == Guid.Empty)
            {
                item.UserID     = Guid.NewGuid();
                item.CreateDate = DateTime.Now;
                item.IsValid    = 1;
                if (Password.Length <= 0)
                {
                    Password = HashEncrypt.md5(CommonLib.Config.SystemInitPassword);
                }
                item.Password = CommonLib.HashEncrypt.BgPassWord(Password);
            }
            else
            {
                item.UserID = ID;
                if (Password.Length > 0)
                {
                    item.Password = CommonLib.HashEncrypt.BgPassWord(Password);
                }
            }
            item.WelfareCentreID = welfareCentreId;
            item.OperateDate     = DateTime.Now;
            item.UserCode        = UserCode;
            item.UserName        = UserName;
            item.RealName        = RealName;
            item.DeptID          = DeptId;
            item.RoleID          = RoleId;
            item.Remark          = Remark;
            item.UserType        = UserType;
            item.IcCardNo        = IcCardNO;

            ParamState = "1";
            ParamID    = item.UserID.ToString();
            bool IsFlag = cBll.AddOrUpdate(item);
            if (IsFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
            #endregion
        }
Beispiel #12
0
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.Save;


            var tempNoAuth = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            #region AddOrUpdate
            Guid     ID          = RequestParameters.PGuid("ID");
            Guid     ddlOrgID    = RequestParameters.PGuid("ddlOrgID");
            Guid     CustomerId  = RequestParameters.PGuid("CustomerId");
            Guid     HgId        = RequestParameters.PGuid("HgId");
            DateTime?ServerStart = RequestParameters.PDateTime("ServerStart");
            DateTime?ServerEnd   = RequestParameters.PDateTime("ServerEnd");
            string   WeekOne     = RequestParameters.Pstring("WeekOne");
            string   WeekTwo     = RequestParameters.Pstring("WeekTwo");
            string   WeekThree   = RequestParameters.Pstring("WeekThree");
            string   WeekFour    = RequestParameters.Pstring("WeekFour");
            string   WeekFive    = RequestParameters.Pstring("WeekFive");
            string   WeekSix     = RequestParameters.Pstring("WeekSix");
            string   WeekServer  = RequestParameters.Pstring("WeekServer");
            string   ServerTime  = RequestParameters.Pstring("ServerTime");
            string   Remark      = RequestParameters.Pstring("Remark");

            var cBll = new PaymentPlanBll();
            var item = new tbPaymentPlan();

            item.ID = ID;

            ParamState = "1";
            ParamID    = item.ID.ToString();

            item.CustomerId      = CustomerId;
            item.HgId            = HgId;
            item.ServerStart     = ServerStart ?? DateTime.Now;
            item.ServerEnd       = ServerEnd ?? DateTime.Now;
            item.WeekOne         = WeekOne;
            item.WeekTwo         = WeekTwo;
            item.WeekThree       = WeekThree;
            item.WeekFour        = WeekFour;
            item.WeekFive        = WeekFive;
            item.WeekSix         = WeekSix;
            item.WeekServer      = WeekServer;
            item.ServerTime      = ServerTime;
            item.Remark          = Remark;
            item.OperateDate     = DateTime.Now;
            item.CreateDate      = DateTime.Now;
            item.OperatorUserID  = Utits.CurrentUserID;
            item.WelfareCentreID = ddlOrgID;
            bool IsFlag = cBll.AddOrUpdate(item);
            if (IsFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
            #endregion
        }
Beispiel #13
0
        public JsonResult ListPhyDelOld()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.PhyDelete;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            string _ids = RequestParameters.Pstring("ids");
            if (string.IsNullOrEmpty(_ids))
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string[] strids = _ids.Split(',');
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < strids.Length; i++)
            {
                if (RegexValidate.IsGuid(strids[i]))
                {
                    arrayList.Add(strids[i]);
                }
            }
            string[] ids = (string[])arrayList.ToArray(typeof(string));
            if (!ids.Any())
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string   _bedIds   = RequestParameters.Pstring("bedIds");
            string[] strbedIds = _bedIds.Split(',');
            System.Collections.ArrayList arrayBedIdList = new System.Collections.ArrayList();
            for (int i = 0; i < strbedIds.Length; i++)
            {
                if (RegexValidate.IsGuid(strbedIds[i]))
                {
                    arrayBedIdList.Add(strbedIds[i]);
                }
            }
            string[] bedIds          = (string[])arrayBedIdList.ToArray(typeof(string));
            var      welfareCentreId = Utits.WelfareCentreID;
            var      cBll            = new PaymentPlanBll();
            bool     isFlag          = cBll.PhysicalDeleteByCondition(ids);
            if (isFlag)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }