Esempio n. 1
0
        public ActionResult OperationResultTest()
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();

            SystemStatusInfo item1 = new SystemStatusInfo();
            item1.SystemStatus = HiLand.Utility.Enums.SystemStatuses.Success;
            item1.Message = "成功信息";
            infoList.Add(item1);

            SystemStatusInfo item2 = new SystemStatusInfo();
            item2.SystemStatus = HiLand.Utility.Enums.SystemStatuses.Failuer;
            item2.Message = "失败信息";
            infoList.Add(item2);

            SystemStatusInfo item3 = new SystemStatusInfo();
            item3.SystemStatus = HiLand.Utility.Enums.SystemStatuses.Warnning;
            item3.Message = "警告信息";
            infoList.Add(item3);

            SystemStatusInfo item4 = new SystemStatusInfo();
            item4.SystemStatus = HiLand.Utility.Enums.SystemStatuses.Tip;
            item4.Message = "提示信息";
            infoList.Add(item4);

            this.TempData.Add("OperationResultData", infoList);
            return RedirectToAction("OperationResults", "System", new {  });
        }
Esempio n. 2
0
        public ActionResult AsynTest()
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            SystemStatusInfo item4 = new SystemStatusInfo();
            item4.SystemStatus = HiLand.Utility.Enums.SystemStatuses.Tip;
            item4.Message = "数据准备中,其完成后会自动下载,请等待。。。";
            infoList.Add(item4);
            this.TempData.Add("OperationResultData", infoList);

            Funcs<ActionResult> commonHandle = new Funcs<ActionResult>(Foo);
            this.TempData["AsynMethod"]= commonHandle;

            commonHandle.BeginInvoke(null,null);
            return RedirectToAction("OperationResults", "System", new { });
        }
Esempio n. 3
0
        /// <summary>
        /// 用户操作结果展示
        /// </summary>
        /// <param name="isSuccessful"></param>
        /// <param name="displayInformation"></param>
        /// <returns></returns>
        public ActionResult OperationResult(bool isSuccessful, string displayInformation)
        {
            SystemStatusInfo statusInfo = new SystemStatusInfo();
            if (isSuccessful == true)
            {
                statusInfo.SystemStatus = SystemStatuses.Success;
            }
            else
            {
                statusInfo.SystemStatus = SystemStatuses.Failuer;
            }

            statusInfo.Message = displayInformation;
            return View(statusInfo);
        }
        public ActionResult Item(string keyGuid, EnterpriseEntity entity, bool isOnlyPlaceHolder = true)
        {
            bool isSuccessful = false;
            string displayMessage = string.Empty;
            string returnUrl = RequestHelper.GetValue("returnUrl");
            bool isUsingCompress = RequestHelper.GetValue<bool>("isUsingCompress");

            EnterpriseEntity targetEntity = null;
            if (GuidHelper.IsInvalidOrEmpty(keyGuid))
            {
                //判断是否达到资源负责人可以控制的最大资源数量
                int realEnterpriseCountOfManager = EnterpriseBLL.Instance.GetTotalCountOfManager(BusinessUserBLL.CurrentUserGuid.ToString(), true);
                int maxEnterpriseCountOfManager = EmployeeBLL.Instance.Get(BusinessUserBLL.CurrentUserGuid).MaxEnterpriseCountOfManager;
                if (maxEnterpriseCountOfManager <= 0)
                {
                    maxEnterpriseCountOfManager = SystemConst.MaxEnterpriseCountOfManager;
                }
                if (realEnterpriseCountOfManager >= maxEnterpriseCountOfManager)
                {
                    List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
                    SystemStatusInfo itemSuccessful = new SystemStatusInfo();
                    itemSuccessful.SystemStatus = SystemStatuses.Warnning;
                    itemSuccessful.Message = string.Format("你目前拥有的企业数量为{0},已经超出了业务允许的最大数量{1},请释放一些企业后再进行录入。", realEnterpriseCountOfManager, maxEnterpriseCountOfManager);
                    infoList.Add(itemSuccessful);

                    this.TempData.Add("OperationResultData", infoList);
                    return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl, isUsingCompress = isUsingCompress });
                }

                targetEntity = new EnterpriseEntity();
                SetTargetEntityValue(entity, ref targetEntity);
                targetEntity.EstablishedTime = DateTime.Now;
                EntityOperateStatuses entityOperateStatus = EntityOperateStatuses.Successful;
                EnterpriseBLL.Instance.Create(targetEntity, out entityOperateStatus);
                if (entityOperateStatus == EntityOperateStatuses.Successful)
                {
                    isSuccessful = true;
                }
                else
                {
                    isSuccessful = false;
                    displayMessage = EnumHelper.GetDisplayValue(entityOperateStatus);
                }
            }
            else
            {
                targetEntity = EnterpriseBLL.Instance.Get(keyGuid);
                SetTargetEntityValue(entity, ref targetEntity);
                EntityOperateStatuses entityOperateStatus = EntityOperateStatuses.Successful;
                EnterpriseBLL.Instance.Update(targetEntity, out entityOperateStatus);

                if (entityOperateStatus == EntityOperateStatuses.Successful)
                {
                    isSuccessful = true;
                }
                else
                {
                    isSuccessful = false;
                    displayMessage = EnumHelper.GetDisplayValue(entityOperateStatus);
                }
            }

            if (isSuccessful == true)
            {
                displayMessage = "数据保存成功";
            }

            if (isUsingCompress == true)
            {
                returnUrl = CompressHelper.Decompress(returnUrl);
            }

            if (isSuccessful == true)
            {
                return Redirect(returnUrl);
            }
            else
            {
                List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
                SystemStatusInfo itemStatus = new SystemStatusInfo();
                itemStatus.SystemStatus = SystemStatuses.Failuer;
                itemStatus.Message = string.Format("{0}", displayMessage);
                infoList.Add(itemStatus);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
                //return Json(new LogicStatusInfo(isSuccessful, displayMessage));
            }
        }
        public ActionResult TransferJobs(bool onlyPlaceHolder = true)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = RequestHelper.CurrentFullUrl;

            Guid sourceUserGuid = ControlHelper.GetRealValue<Guid>("SourceUser");
            string sourceUserName = RequestHelper.GetValue("SourceUser");

            Guid targetUserGuid = ControlHelper.GetRealValue<Guid>("TargetUser");
            string targetUserName = RequestHelper.GetValue("TargetUser");
            if (targetUserGuid == Guid.Empty)
            {
                targetUserName = "******";
            }

            Guid enterpriseGuid = ControlHelper.GetRealValue<Guid>("EnterpriseName");

            //被移交人如果为空,那么表示将源移交人的数据释放到共享库中
            if (sourceUserGuid == Guid.Empty)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = string.Format("请先选择移交人信息,谢谢。");
                infoList.Add(itemError);
            }
            else
            {
                #region 劳务人员移交
                {
                    int rowCount = UpdateLaborData(sourceUserGuid, targetUserGuid, targetUserName, enterpriseGuid);

                    if (rowCount > 0)
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Success;
                        itemError.Message = string.Format("劳务人员数据移交成功!共移交{0}笔数据。", rowCount);
                        infoList.Add(itemError);
                    }
                    else
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Tip;
                        itemError.Message = string.Format("{0}尚无劳务人员数据需要移交。", sourceUserName);
                        infoList.Add(itemError);
                    }
                }
                #endregion

                #region 企业移交
                {
                    int rowCount = UpdateEnterpriseData(sourceUserGuid, targetUserGuid, targetUserName, enterpriseGuid);

                    if (rowCount > 0)
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Success;
                        itemError.Message = string.Format("企业数据移交成功!共移交{0}笔数据。", rowCount);
                        infoList.Add(itemError);
                    }
                    else
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Tip;
                        itemError.Message = string.Format("{0}尚无企业数据需要移交。", sourceUserName);
                        infoList.Add(itemError);
                    }
                }
                #endregion

                #region 信息员移交
                {
                    int rowCount = UpdateInformationBrokerData(sourceUserGuid, targetUserGuid, targetUserName);

                    if (rowCount > 0)
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Success;
                        itemError.Message = string.Format("信息员数据移交成功!共移交{0}笔数据。", rowCount);
                        infoList.Add(itemError);
                    }
                    else
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Tip;
                        itemError.Message = string.Format("{0}尚无信息员数据需要移交。", sourceUserName);
                        infoList.Add(itemError);
                    }
                }
                #endregion
            }

            this.TempData.Add("OperationResultData", infoList);
            return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
        }
        /// <summary>
        /// 用户操作结果展示
        /// </summary>
        /// <param name="isSuccessful"></param>
        /// <param name="displayInformation"></param>
        /// <returns></returns>
        public ActionResult OperationResult(bool isSuccessful, string displayInformation, string returnUrl = StringHelper.Empty, bool isUsingCompress = false)
        {
            SystemStatusInfo statusInfo = new SystemStatusInfo();
            if (isSuccessful == true)
            {
                statusInfo.SystemStatus = SystemStatuses.Success;
            }
            else
            {
                statusInfo.SystemStatus = SystemStatuses.Failuer;
            }

            statusInfo.Message = displayInformation;
            List<SystemStatusInfo> statusInfos = new List<SystemStatusInfo>();
            statusInfos.Add(statusInfo);

            this.TempData.Add("OperationResultData", statusInfos);
            return RedirectToAction("OperationResults", new { returnUrl = returnUrl, isUsingCompress = isUsingCompress });
        }
Esempio n. 7
0
        public ActionResult Item(string itemKey, LaborEntity entity, bool isOnlyPlaceHolder = true)
        {
            bool isSuccessful = false;
            string displayMessage = string.Empty;
            CreateUserRoleStatuses createStatus = CreateUserRoleStatuses.Successful;

            string returnUrl = RequestHelper.GetValue("returnUrl");
            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                returnUrl = Url.Action("Index");
            }
            else
            {
                bool isUsingCompress = RequestHelper.GetValue<bool>("isUsingCompress");
                if (isUsingCompress == true)
                {
                    returnUrl = CompressHelper.Decompress(returnUrl);
                }
            }

            LaborEntity targetEntity = null;
            if (GuidHelper.IsInvalidOrEmpty(itemKey))
            {
                targetEntity = new LaborEntity();
                SetTargetEntityValue(entity, ref targetEntity);
                targetEntity.UserRegisterDate = DateTime.Now;
                targetEntity.UserType = UserTypes.CommonUser;
                targetEntity.Password = SystemConst.InitialUserPassword;
                targetEntity.LaborWorkStatus = LaborWorkStatuses.NewWorker;
                targetEntity.ComeFromType = ComeFromTypes.ManageWrite;
                //首次录入系统,劳务人员的状态为未激活
                targetEntity.UserStatus = UserStatuses.Unactivated;
                createStatus = LaborBLL.Instance.Create(targetEntity);
                if (createStatus == CreateUserRoleStatuses.Successful)
                {
                    isSuccessful = true;
                }
            }
            else
            {
                targetEntity = LaborBLL.Instance.Get(itemKey);
                SetTargetEntityValue(entity, ref targetEntity);

                isSuccessful = LaborBLL.Instance.Update(targetEntity);
                if (isSuccessful == false)
                {
                    createStatus = CreateUserRoleStatuses.FailureUnknowReason;
                }
            }

            if (isSuccessful == true)
            {
                displayMessage = "数据保存成功";
            }
            else
            {
                displayMessage = string.Format("数据保存失败,原因为{0}", EnumHelper.GetDisplayValue(createStatus));
            }

            if (isSuccessful == true)
            {
                return Redirect(returnUrl);
            }
            else
            {
                List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
                SystemStatusInfo itemStatus = new SystemStatusInfo();
                itemStatus.SystemStatus = SystemStatuses.Failuer;
                itemStatus.Message = string.Format("{0}", displayMessage);
                infoList.Add(itemStatus);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
        }
Esempio n. 8
0
        public ActionResult ContractQueryList(int id = 1)
        {
            //1.如果是点击查询控件的查询按钮,那么将查询条件作为QueryString附加在地址后面(为了在客户端保存查询条件的状体),重新发起一次请求。
            if (this.Request.HttpMethod.ToLower().Contains("post"))
            {
                string targetUrlWithoutParam = Url.Action("ContractQueryList", new { id = 1 });
                string targetUrl = QueryControlHelper.GetNewQueryUrl("QueryControl", targetUrlWithoutParam);
                return Redirect(targetUrl);
            }

            //2.通常情形下走get查询
            int pageIndex = id;
            int pageSize = SystemConst.CountPerPageForLaborList;
            int startIndex = (pageIndex - 1) * pageSize + 1;
            string whereClause = " 1=1 ";

            whereClause += " AND " + QueryControlHelper.GetQueryCondition("QueryControl");

            //处理在职时间段问题
            DateTime jobingDateStart = DateTimeHelper.Min;
            DateTime jobingDateEnd = DateTimeHelper.Min;
            if (whereClause.Contains("JobingDate"))
            {
                string jobingDateStringAll = whereClause.Substring(whereClause.IndexOf("JobingDate"));
                string jobingDateStringNoLeftBlacket = jobingDateStringAll.Substring(jobingDateStringAll.IndexOf("'") + 1);
                string jobingDateString = jobingDateStringNoLeftBlacket.Substring(0, jobingDateStringNoLeftBlacket.IndexOf("'"));
                jobingDateStart = Converter.ChangeType<DateTime>(jobingDateString, DateTimeHelper.Min);
            }

            if (whereClause.Contains("JobingDate"))
            {
                string jobingDateStringAll = whereClause.Substring(whereClause.LastIndexOf("JobingDate"));
                string jobingDateStringNoLeftBlacket = jobingDateStringAll.Substring(jobingDateStringAll.IndexOf("'") + 1);
                string jobingDateString = jobingDateStringNoLeftBlacket.Substring(0, jobingDateStringNoLeftBlacket.IndexOf("'"));
                jobingDateEnd = Converter.ChangeType<DateTime>(jobingDateString, DateTimeHelper.Min);
            }

            if ((jobingDateStart != DateTimeHelper.Min && jobingDateEnd == DateTimeHelper.Min) || (jobingDateStart == DateTimeHelper.Min && jobingDateEnd != DateTimeHelper.Min))
            {
                List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
                string returnUrl = Url.Action("ContractQueryList", new { id = 1 });
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "请同时选择在职时间开始和在职时间结束!";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }

            if (jobingDateStart != DateTimeHelper.Min && jobingDateEnd != DateTimeHelper.Min)
            {
                whereClause = whereClause.Substring(0, whereClause.IndexOf("JobingDate"));
                whereClause = whereClause.TrimEnd(' ', '(').ToLower();

                if (whereClause.EndsWith("and") || whereClause.EndsWith("or"))
                {
                    string whereClauseForJobing = string.Format(@" (
                                    ( LaborContractStartDate>='{1}' AND (LaborContractStartDate<='{2}') ) OR
                                    ( LaborContractDiscontinueDate>='{1}' AND (LaborContractDiscontinueDate<='{2}') ) OR
                                    ( LaborContractStartDate<'{1}' AND (LaborContractDiscontinueDate>'{2}' OR LaborContractDiscontinueDate is null OR LaborContractDiscontinueDate='{0}' ))
                                    ) ", DateTimeHelper.Min, jobingDateStart, jobingDateEnd);
                    whereClause += whereClauseForJobing;
                }
            }

            string orderClause = "LaborContractID DESC";

            PagedEntityCollection<LaborContractEntity> entityList = LaborContractBLL.Instance.GetPagedCollection(startIndex, pageSize, whereClause, orderClause);
            PagedList<LaborContractEntity> pagedExList = new PagedList<LaborContractEntity>(entityList.Records, entityList.PageIndex, entityList.PageSize, entityList.TotalCount);

            bool isExportExcel = RequestHelper.GetValue("exportExcel", false);
            if (isExportExcel == true)
            {
                return LaborContractListToExcelFile(entityList.Records);
            }
            else
            {
                return View(pagedExList);
            }
        }
Esempio n. 9
0
        public ActionResult BankCardBatch(bool isOnlyPlaceHolder = true)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = RequestHelper.CurrentFullUrl;

            string bankName = RequestHelper.GetValue("BankName");
            string bankBranch = RequestHelper.GetValue("Branch");

            int headerRowNumber = RequestHelper.GetValue<int>("headerRowNumber", 3);
            HttpPostedFile postedFile = RequestHelper.CurrentRequest.Files["fileSelector"];

            #region 条件判定(如果不满足基本条件直接跳出并提示)
            if (HttpPostedFileHelper.HasFile(postedFile) == false)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "没有选择Excel文件,请先选择文件然后再进行导入!";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            #endregion

            try
            {
                #region 将数据读入内存
                int userCountSuccessful = 0;
                int userCountFailure = 0;
                string userListFailure = string.Empty;
                DataTable dataTable = ExcelHelper.ReadExcel(postedFile.InputStream, headerRowNumber);
                NameValueCollection bankCardItemMapData = (NameValueCollection)ConfigurationManager.GetSection("bankCardItemMap");

                List<string> columnNameList = new List<string>();
                for (int i = 0; i < dataTable.Columns.Count; i++)
                {
                    columnNameList.Add(dataTable.Columns[i].ColumnName);
                }
                #endregion

                #region 对Excel的每行信息进行解析
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    int dataRowNumberInExcel = headerRowNumber + i + 1;
                    try
                    {
                        DataRow row = dataTable.Rows[i];
                        if (row == null)
                        {
                            continue;
                        }

                        string laborUserNameCN = string.Empty;
                        string laborUserCardID = string.Empty;

                        Guid bankCardGuid = GuidHelper.NewGuid();
                        BankEntity bankEntity = new BankEntity();
                        bankEntity.BankGuid = bankCardGuid;
                        bankEntity.BankName = bankName;
                        bankEntity.Branch = bankBranch;

                        foreach (string columnName in columnNameList)
                        {
                            //1.根据Excel文件中的列名称映射银行卡实体的属性名称
                            string propertyName = bankCardItemMapData[columnName];
                            if (string.IsNullOrWhiteSpace(propertyName))
                            {
                                continue;
                            }

                            //2.给银行卡实体属性赋值
                            object cellValue = row[columnName];
                            if (cellValue != null)
                            {
                                switch (propertyName)
                                {
                                    case "UserNameCN":
                                        laborUserNameCN = cellValue.ToString();
                                        break;
                                    case "UserCardID":
                                        laborUserCardID = cellValue.ToString();
                                        break;
                                    case "AccountNumber":
                                        bankEntity.AccountNumber = cellValue.ToString();
                                        break;
                                    case "CompanyName":
                                        //Hack:xieran20121022 暂时使用BankAddress记录公司信息
                                        bankEntity.BankAddress = cellValue.ToString();
                                        break;
                                    default:
                                        //do nothing.
                                        break;
                                }
                            }
                        }

                        if (string.IsNullOrWhiteSpace(laborUserNameCN) || string.IsNullOrWhiteSpace(laborUserCardID))
                        {
                            userCountFailure++;
                            userListFailure += string.Format("{0}({1}({2})请确认此用户的用户名称和身份证号均不可以为空), <br />", dataRowNumberInExcel, laborUserNameCN, laborUserCardID);
                        }
                        else
                        {
                            //根据人员姓名和身份证号,确认劳务人员的UserGuid
                            BusinessUser labor = BusinessUserBLL.GetByUserIDCard(laborUserCardID);
                            if (labor != null && labor.IsEmpty == false)
                            {
                                if (labor.UserNameCN == laborUserNameCN)
                                {
                                    bankEntity.AccountName = laborUserNameCN;
                                    bankEntity.UserGuid = labor.UserGuid;
                                    bankEntity.IsPrimary = Logics.True;

                                    bool isSuccessful = BankBLL.Instance.Create(bankEntity);
                                    if (isSuccessful == true)
                                    {
                                        userCountSuccessful++;
                                    }
                                    else
                                    {
                                        userCountFailure++;
                                        userListFailure += string.Format("{0}({1}({2})错误未知), <br />", dataRowNumberInExcel, laborUserNameCN, laborUserCardID);
                                    }
                                }
                                else
                                {
                                    userCountFailure++;
                                    userListFailure += string.Format("{0}({1}({2})请确认此用户的用户名称和身份证号是否跟系统内的数据一致), <br />", dataRowNumberInExcel, laborUserNameCN, laborUserCardID);
                                }
                            }
                            else
                            {
                                userCountFailure++;
                                userListFailure += string.Format("{0}({1}({2})请确认此用户的用户名称和身份证号是否跟系统内的数据一致), <br />", dataRowNumberInExcel, laborUserNameCN, laborUserCardID);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        userCountFailure++;
                        userListFailure += i + ", ";
                    }
                }
                #endregion

                #region 操作结果展示
                //A.1、操作结果(导入成功的人员信息)
                SystemStatusInfo itemSuccessful = new SystemStatusInfo();
                itemSuccessful.SystemStatus = SystemStatuses.Success;
                itemSuccessful.Message = string.Format("共有{0}人导入成功。", userCountSuccessful);
                infoList.Add(itemSuccessful);

                //A.2、操作结果(导入失败的人员信息)
                if (userCountFailure > 0)
                {
                    SystemStatusInfo itemError = new SystemStatusInfo();
                    itemError.SystemStatus = SystemStatuses.Failuer;
                    itemError.Message = string.Format("共有{0}人导入失败。", userCountFailure);
                    if (string.IsNullOrWhiteSpace(userListFailure) == false)
                    {
                        itemError.Message += string.Format("导入失败的人员分别位于{0}行, <br />", userListFailure);
                    }
                    infoList.Add(itemError);
                }
                #endregion
            }
            catch (OfficeXmlFileException)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "请选择Excel2003格式的文件。你可以将本文件在Excel中另存的时候选择97/2003格式!";
                infoList.Add(itemError);
            }

            this.TempData.Add("OperationResultData", infoList);
            return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
        }
Esempio n. 10
0
        public ActionResult BatchEntering(bool isOnlyPlaceholder = true)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = RequestHelper.CurrentFullUrl;

            int headerRowNumber = RequestHelper.GetValue<int>("headerRowNumber", 1);

            HttpPostedFile postedFile = RequestHelper.CurrentRequest.Files["fileSelector"];
            if (HttpPostedFileHelper.HasFile(postedFile))
            {
                try
                {
                    int userCountSuccessful = 0;
                    int userCountFailure = 0;
                    string userListFailure = string.Empty;

                    DataTable dataTable = ExcelHelper.ReadExcel(postedFile.InputStream, headerRowNumber);
                    NameValueCollection laborMapData = (NameValueCollection)ConfigurationManager.GetSection("laborBasicDataMap");

                    List<string> columnNameList = new List<string>();
                    for (int i = 0; i < dataTable.Columns.Count; i++)
                    {
                        columnNameList.Add(dataTable.Columns[i].ColumnName);
                    }

                    //Hack:xieran20121109 为了匹配所有的服务角色的guid,这里获取全部内部员工的信息,如果以后员工人数数量
                    //增加到一个程度后,可能会有性能问题
                    List<BusinessUser> employeeList = BusinessUserBLL.GetList(UserTypes.Manager);

                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {
                        int originalExcelRowNumber = headerRowNumber + i + 1;
                        try
                        {
                            DataRow row = dataTable.Rows[i];
                            if (row == null)
                            {
                                continue;
                            }

                            string userAgeString = string.Empty;
                            string userBirhdayString = string.Empty;
                            string userSexString = string.Empty;

                            LaborEntity laborEntity = new LaborEntity();
                            foreach (string columnName in columnNameList)
                            {
                                //1.根据Excel文件中的列名称映射Labor实体的属性名称
                                string propertyName = laborMapData[columnName];
                                if (string.IsNullOrWhiteSpace(propertyName))
                                {
                                    continue;
                                }

                                //2.给Labor实体属性赋值
                                object cellValue = row[columnName];
                                if (cellValue != null)
                                {
                                    switch (propertyName)
                                    {
                                        case "HouseHoldType":
                                            laborEntity.HouseHoldType = EnumHelper.GetItem<HouseHoldTypes>(cellValue.ToString());
                                            break;
                                        case "MaritalStatus":
                                            laborEntity.MaritalStatus = EnumHelper.GetItem<MaritalStatuses>(cellValue.ToString());
                                            break;
                                        case "UserSex":
                                            userSexString = cellValue.ToString();
                                            break;
                                        case "UserEducationalBackground":
                                            laborEntity.UserEducationalBackground = EnumHelper.GetItem<EducationalBackgrounds>(cellValue.ToString());
                                            break;
                                        case "UserAge":
                                            userAgeString = cellValue.ToString();
                                            break;
                                        case "UserBirthday":
                                            userBirhdayString = cellValue.ToString();
                                            break;
                                        default:
                                            ReflectHelper.SetPropertyValue<LaborEntity>(laborEntity, propertyName, cellValue);
                                            break;
                                    }
                                }
                            }

                            laborEntity.Password = SystemConst.InitialUserPassword;
                            laborEntity.UserType = UserTypes.CommonUser;
                            laborEntity.UserRegisterDate = DateTime.Now;

                            //从Excel导入的各个服务角色的姓名,以下将其转换为guid
                            laborEntity.ProviderUserGuid = GetEmployeeGuid(employeeList, laborEntity.ProviderUserName);
                            laborEntity.RecommendUserGuid = GetEmployeeGuid(employeeList, laborEntity.RecommendUserName);
                            laborEntity.FinanceUserGuid = GetEmployeeGuid(employeeList, laborEntity.FinanceUserName);
                            laborEntity.ServiceUserGuid = GetEmployeeGuid(employeeList, laborEntity.ServiceUserName);
                            laborEntity.BusinessUserGuid = GetEmployeeGuid(employeeList, laborEntity.BusinessUserName);
                            laborEntity.SettleUserGuid = GetEmployeeGuid(employeeList, laborEntity.SettleUserName);

                            laborEntity.InformationBrokerUserGuid = GetInformationBrokerGuid(laborEntity.InformationBrokerUserName);

                            IDCard idCard = IDCard.Parse(laborEntity.UserCardID);
                            //人员生日的抽取先后顺序1、直接的生日输入 2、身份证中提取 3、年龄计算。(满足前面的条件,自动跳过后面的条件)
                            DateTime userBirthDay = DateTimeHelper.Parse(userBirhdayString, DateFormats.YMD);
                            if (userBirthDay == DateTimeHelper.Min)
                            {
                                userBirthDay = idCard.BirthDay;
                            }
                            if (userBirthDay == DateTimeHelper.Min)
                            {
                                userBirthDay = new DateTime(DateTime.Today.Year - Converter.ChangeType(userAgeString, 25), 1, 1);
                            }
                            laborEntity.UserBirthDay = userBirthDay;

                            //人员性别的抽取顺序1、直接输入的性别 2、身份证中提取
                            Sexes userSex = EnumHelper.GetItem<Sexes>(userSexString, string.Empty, Sexes.UnSet);
                            if (userSex == Sexes.UnSet)
                            {
                                userSex = idCard.Sex;
                            }
                            laborEntity.UserSex = userSex;

                            //必须人员姓名和身份证同时为空时,不保存
                            if (string.IsNullOrWhiteSpace(laborEntity.UserNameCN) && string.IsNullOrWhiteSpace(laborEntity.UserCardID))
                            {
                                userCountFailure++;
                                userListFailure += string.Format("{0}(人员姓名和身份证同时为空), <br />", originalExcelRowNumber);
                            }
                            else
                            {
                                laborEntity.ComeFromType = ComeFromTypes.ManageBatch;
                                //首次录入系统,劳务人员的状态为未激活
                                laborEntity.UserStatus = UserStatuses.Unactivated;
                                CreateUserRoleStatuses createStatus = LaborBLL.Instance.Create(laborEntity);

                                if (createStatus == CreateUserRoleStatuses.Successful)
                                {
                                    userCountSuccessful++;
                                }
                                else
                                {
                                    userCountFailure++;
                                    userListFailure += string.Format("{0}({1}), <br />", originalExcelRowNumber, EnumHelper.GetDisplayValue(createStatus));
                                }
                            }
                        }
                        catch (Exception)
                        {
                            userCountFailure++;
                            userListFailure += originalExcelRowNumber + ", <br />";
                        }
                    }

                    SystemStatusInfo itemSuccessful = new SystemStatusInfo();
                    itemSuccessful.SystemStatus = SystemStatuses.Success;
                    itemSuccessful.Message = string.Format("共有{0}人导入成功。", userCountSuccessful);
                    infoList.Add(itemSuccessful);

                    if (userCountFailure > 0)
                    {
                        SystemStatusInfo itemError = new SystemStatusInfo();
                        itemError.SystemStatus = SystemStatuses.Failuer;
                        itemError.Message = string.Format("共有{0}人导入失败。", userCountFailure);
                        if (string.IsNullOrWhiteSpace(userListFailure) == false)
                        {
                            itemError.Message += string.Format("导入失败的人员分别位于{0}行", userListFailure);
                        }
                        infoList.Add(itemError);
                    }
                }
                catch (NPOI.POIFS.FileSystem.OfficeXmlFileException)
                {
                    SystemStatusInfo itemError = new SystemStatusInfo();
                    itemError.SystemStatus = SystemStatuses.Failuer;
                    itemError.Message = "请选择Excel2003格式的文件。你可以将本文件在Excel中另存的时候选择97/2003格式!";
                    infoList.Add(itemError);
                }
            }
            else
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "没有选择Excel文件,请先选择文件然后再进行导入!";
                infoList.Add(itemError);
            }

            this.TempData.Add("OperationResultData", infoList);
            return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
        }
Esempio n. 11
0
        public ActionResult SalaryToBank(bool isOnlyPlaceHolder = true)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = RequestHelper.CurrentFullUrl;

            string enterpriseGuid = ControlHelper.GetRealValue("EnterpriseName", string.Empty);
            EnterpriseEntity enterpriseEntity = EnterpriseEntity.Empty;
            string salaryMonth = RequestHelper.GetValue("salaryMonth");
            DateTime salaryDate = DateTimeHelper.Min;

            if (string.IsNullOrWhiteSpace(salaryMonth))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定薪资月份,请选择。";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                salaryMonth = salaryMonth + "/1";
                salaryDate = DateTimeHelper.Parse(salaryMonth, DateFormats.YMD);
            }

            if (GuidHelper.IsInvalidOrEmpty(enterpriseGuid))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定企业的名称信息,请选择。";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                enterpriseEntity = EnterpriseBLL.Instance.Get(enterpriseGuid);
            }

            DataTable salaryTable = GenerateSalaryDataTabel(enterpriseEntity, salaryDate);
            Stream salaryStream = ExcelHelper.WriteExcel(salaryTable, false);

            string fileDownloadName = string.Format("{0}-{1}", enterpriseEntity.CompanyName, salaryDate.ToString("yyyyMM"));
            return File(salaryStream, ContentTypes.GetContentType("xls"), fileDownloadName);
        }
Esempio n. 12
0
        public ActionResult SalaryListCheck(bool isOnlyPlaceHolder = true)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = Url.Action("SalaryListPreSelector");

            //1.加入对预选择条件的过滤
            string enterpriseKey = RequestHelper.GetValue("enterpriseKey");
            string salaryMonth = RequestHelper.GetValue("salaryMonth");
            if (GuidHelper.IsInvalidOrEmpty(enterpriseKey))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定企业信息,请选择。";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }

            DateTime salaryDateFirstDay = DateTime.Today;
            DateTime salaryDateStart = DateTime.Today;
            DateTime salaryDateEnd = DateTime.Today;

            if (string.IsNullOrWhiteSpace(salaryMonth))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定薪资月份,请选择。";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                salaryMonth = HttpUtility.UrlDecode(salaryMonth);
                string salaryDateString = salaryMonth + "/1";
                salaryDateFirstDay = DateTimeHelper.Parse(salaryDateString, DateFormats.YMD);
            }

            salaryDateStart = RequestHelper.GetValue<DateTime>("JobingDateStart", DateTimeHelper.Min);
            salaryDateEnd = RequestHelper.GetValue<DateTime>("JobingDateEnd", DateTimeHelper.Min);
            if (salaryDateStart == DateTimeHelper.Min && salaryDateEnd == DateTimeHelper.Min)
            {
                salaryDateStart = DateTimeHelper.GetFirstDateOfMonth(salaryDateFirstDay);
                salaryDateEnd = DateTimeHelper.GetLastDateOfMonth(salaryDateFirstDay);
            }

            List<LaborContractEntity> laborContractList = LaborContractBLL.Instance.GetList(salaryDateStart, salaryDateEnd, new Guid(enterpriseKey));
            List<LaborEntity> unMatchedLaborList = new List<LaborEntity>();
            List<SalarySummaryEntity> salarySummaryList = SalarySummaryBLL.Instance.GetList(enterpriseKey, salaryDateFirstDay);
            for (int j = laborContractList.Count - 1; j >= 0; j--)
            {
                LaborContractEntity laborItem = laborContractList[j];
                bool isMatch = false;
                for (int i = 0; i < salarySummaryList.Count; i++)
                {
                    if (laborItem.LaborUserGuid.ToString() == salarySummaryList[i].LaborKey)
                    {
                        isMatch = true;
                        break;
                    }
                }

                if (isMatch == false)
                {
                    unMatchedLaborList.Add(laborItem.Labor);
                }
            }

            if (unMatchedLaborList.Count == 0)
            {
                SystemStatusInfo statusItem = new SystemStatusInfo();
                statusItem.SystemStatus = SystemStatuses.Success;
                statusItem.Message = "没有应付而未付的人员!";
                infoList.Add(statusItem);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                SystemStatusInfo statusItem = new SystemStatusInfo();
                statusItem.SystemStatus = SystemStatuses.Warnning;
                statusItem.Message = "实付人员数量与应付人员数量有差别,具体如下人员应付而未付:";
                foreach (LaborEntity laborItem in unMatchedLaborList)
                {
                    statusItem.Message += string.Format("{0}({1})({2}), <br />", laborItem.UserNameCN, laborItem.LaborCode, laborItem.UserCardID);
                }
                infoList.Add(statusItem);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
        }
Esempio n. 13
0
        public ActionResult SalaryList(int id = 1)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = Url.Action("SalaryListPreSelector");

            int pageIndex = id;
            int pageSize = SystemConst.CountPerPage;
            int startIndex = (pageIndex - 1) * pageSize + 1;
            string whereClause = " 1=1 ";
            string orderClause = "SalarySummaryID DESC";

            //1.加入对预选择条件的过滤
            string enterpriseKey = RequestHelper.GetValue("enterpriseKey");
            string salaryMonth = RequestHelper.GetValue("salaryMonth");
            if (string.IsNullOrWhiteSpace(enterpriseKey))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定企业信息,请选择。";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                whereClause += string.Format(" AND BIZ.EnterpriseKey='{0}' ", enterpriseKey);
            }

            if (string.IsNullOrWhiteSpace(salaryMonth))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定薪资月份,请选择。";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                salaryMonth = HttpUtility.UrlDecode(salaryMonth);
                string salaryDateString = salaryMonth + "/1";
                DateTime salaryDateFirstDay = DateTimeHelper.Parse(salaryDateString, DateFormats.YMD);
                DateTime salaryDateLastDay = DateTimeHelper.GetFirstDateOfMonth(salaryDateFirstDay.AddMonths(1));
                whereClause += string.Format(" AND SalaryDate>='{0}' AND SalaryDate<'{1}' ", salaryDateFirstDay, salaryDateLastDay);
            }

            //2、加入对查询控件选择条件的过滤
            //2.1、如果是点击查询控件的查询按钮,那么将查询条件作为QueryString附加在地址后面(为了在客户端保存查询条件的状体),重新发起一次请求。
            if (this.Request.HttpMethod.ToLower().Contains("post"))
            {
                string targetUrlWithoutParam = Url.Action("SalaryList", new { id = 1, enterpriseKey = enterpriseKey, salaryMonth = salaryMonth });
                string targetUrl = QueryControlHelper.GetNewQueryUrl("LaborQuery", targetUrlWithoutParam);
                return Redirect(targetUrl);
            }

            //2.2、通常情形下走get查询
            whereClause += " AND " + QueryControlHelper.GetQueryCondition("LaborQuery");
            PagedEntityCollection<SalarySummaryEntity> entityList = SalarySummaryBLL.Instance.GetPagedCollection(startIndex, pageSize, whereClause, orderClause);
            PagedList<SalarySummaryEntity> pagedExList = new PagedList<SalarySummaryEntity>(entityList.Records, entityList.PageIndex, entityList.PageSize, entityList.TotalCount);

            bool isExportExcel = RequestHelper.GetValue("exportExcel", false);
            if (isExportExcel == true)
            {
                return SalaryListToExcelFile(entityList.Records);
            }
            else
            {
                return View(pagedExList);
            }
        }
Esempio n. 14
0
        public ActionResult SalaryItem(bool isOnlyPlaceHolder = true)
        {
            string returnUrl = RequestHelper.CurrentFullUrl;
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();

            string enterpriseKey = RequestHelper.GetValue("enterpriseGuid");
            Guid userGuid = RequestHelper.GetValue<Guid>("UserNameCN_Value");
            string salaryMonth = RequestHelper.GetValue(PassingParamValueSourceTypes.Form, "salaryMonth", "");
            DateTime salaryMonthDate = DateTimeHelper.Min;
            LaborEntity labor = LaborEntity.Empty;
            string salarySettlementStart = RequestHelper.GetValue(PassingParamValueSourceTypes.Form, "SettlementStartDate", "");
            string salarySettlementEnd = RequestHelper.GetValue(PassingParamValueSourceTypes.Form, "SettlementEndDate", "");
            DateTime salarySettlementStartDate = Converter.ChangeType(salarySettlementStart, DateTimeHelper.Min);
            DateTime salarySettlementEndDate = Converter.ChangeType(salarySettlementEnd, DateTimeHelper.Min); ;

            #region 数据验证
            if (enterpriseKey == String.Empty)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "无法确定企业信息";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }

            if (salarySettlementStartDate == DateTimeHelper.Min)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "请选择结算开始日期信息";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }

            if (salarySettlementEndDate == DateTimeHelper.Min)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "请选择结算结束日期信息";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }

            if (userGuid == Guid.Empty)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "请先输入并选择人员信息";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                labor = LaborBLL.Instance.Get(userGuid);
            }

            if (salaryMonth == string.Empty)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "请先输入薪资月份信息";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                salaryMonthDate = DateTimeHelper.Parse(salaryMonth + "/1", DateFormats.YMD);
            }
            #endregion

            if (salaryMonthDate == DateTimeHelper.Min)
            {
                salaryMonthDate = DateTimeHelper.GetFirstDateOfMonth(DateTime.Today);
            }

            //判断某人某月是否已经有薪资记录。1、如果有就直接使用,2、如果没有就创建新的薪资数据;(以此保证人员某月薪资数据的唯一)
            bool isSuccessful = true;
            SalarySummaryEntity salarySummaryEntity = SalarySummaryBLL.Instance.Get(enterpriseKey, labor.UserGuid.ToString(), salaryMonthDate);

            if (salarySummaryEntity.IsEmpty)
            {
                salarySummaryEntity.SalarySummaryGuid = GuidHelper.NewGuid();
                salarySummaryEntity.CreateDate = DateTime.Now;
                salarySummaryEntity.CreateUserKey = BusinessUserBLL.CurrentUserGuid.ToString();
                salarySummaryEntity.EnterpriseKey = enterpriseKey;
                salarySummaryEntity.SalaryDate = salaryMonthDate;
                salarySummaryEntity.LaborCode = labor.LaborCode;
                salarySummaryEntity.LaborKey = labor.UserGuid.ToString();
                salarySummaryEntity.LaborName = labor.UserNameCN;
                salarySummaryEntity.SalarySettlementStartDate = salarySettlementStartDate;
                salarySummaryEntity.SalarySettlementEndDate = salarySettlementEndDate;

                //Logics isFirstCash = SalarySummaryBLL.Instance.IsFirstCash(enterpriseKey, labor.UserGuid.ToString());
                //salarySummaryEntity.IsFirstCash = isFirstCash;

                isSuccessful = SalarySummaryBLL.Instance.Create(salarySummaryEntity);
            }

            if (isSuccessful == true)
            {
                return RedirectToAction("SalaryDetailsList", new { itemKey = salarySummaryEntity.SalarySummaryGuid, enterpriseKey = enterpriseKey });
            }
            else
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "未知错误";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
        }
Esempio n. 15
0
        public ActionResult SalaryDeleteByEnterprise()
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = Url.Action("SalaryListPreSelector");

            string enterpriseKey = RequestHelper.GetValue("EnterpriseName_Value");
            string enterpriseName = RequestHelper.GetValue("EnterpriseName");
            string salaryMonth = RequestHelper.GetValue("SalaryMonth");
            salaryMonth = HttpUtility.UrlDecode(salaryMonth);
            string salaryDateString = salaryMonth + "/1";

            SalarySummaryBLL.Instance.DeleteList(enterpriseKey, Converter.ChangeType(salaryDateString, DateTimeHelper.Min));

            SystemStatusInfo itemError = new SystemStatusInfo();
            itemError.SystemStatus = SystemStatuses.Success;
            itemError.Message = string.Format("企业【{0}】【{1}】月份的薪资数据已经被成功删除。", enterpriseName, salaryMonth);
            infoList.Add(itemError);
            this.TempData.Add("OperationResultData", infoList);
            return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
        }
Esempio n. 16
0
        public ActionResult SalaryBatch(bool isOnlyPlaceHolder = true)
        {
            List<SystemStatusInfo> infoList = new List<SystemStatusInfo>();
            string returnUrl = RequestHelper.CurrentFullUrl;

            Guid enterpriseGuid = ControlHelper.GetRealValue<Guid>("EnterpriseName");
            int headerRowNumber = RequestHelper.GetValue<int>("headerRowNumber", 1);
            string salaryDateString = RequestHelper.GetValue("SalaryMonth");
            DateTime salaryDate = DateTimeHelper.Min;
            HttpPostedFile postedFile = RequestHelper.CurrentRequest.Files["fileSelector"];

            string SettlementStartDateString = RequestHelper.GetValue("SettlementStartDate");
            DateTime SettlementStartDate = Converter.ChangeType(SettlementStartDateString, DateTime.Today);

            string SettlementEndDateString = RequestHelper.GetValue("SettlementEndDate");
            DateTime SettlementEndDate = Converter.ChangeType(SettlementEndDateString, DateTime.Today);

            string SalaryCashDateString = RequestHelper.GetValue("SalaryCashDate");
            DateTime SalaryCashDate = Converter.ChangeType(SalaryCashDateString, DateTime.Today);

            string ManageFeeCashDateString = RequestHelper.GetValue("ManageFeeCashDate");
            DateTime ManageFeeCashDate = Converter.ChangeType(ManageFeeCashDateString, DateTime.Today);

            string InsuranceCashDateString = RequestHelper.GetValue("InsuranceCashDate");
            DateTime InsuranceCashDate = Converter.ChangeType(InsuranceCashDateString, DateTime.Today);

            string ReserveFundDateString = RequestHelper.GetValue("ReserveFundDate");
            DateTime ReserveFundDate = Converter.ChangeType(ReserveFundDateString, DateTime.Today);

            string GeneralRecruitDateString = RequestHelper.GetValue("GeneralRecruitDate");
            DateTime GeneralRecruitDate = Converter.ChangeType(GeneralRecruitDateString, DateTime.Today);

            string OnceRecruitDateString = RequestHelper.GetValue("OnceRecruitDate");
            DateTime OnceRecruitDate = Converter.ChangeType(OnceRecruitDateString, DateTime.Today);

            string OtherInsuranceCashDateString = RequestHelper.GetValue("OtherInsuranceCashDate");
            DateTime OtherInsuranceCashDate = Converter.ChangeType(OtherInsuranceCashDateString, DateTime.Today);

            string TaxFeeCashDateString = RequestHelper.GetValue("TaxFeeCashDate");
            DateTime TaxFeeCashDate = Converter.ChangeType(TaxFeeCashDateString, DateTime.Today);
            #region 条件判定(如果不满足基本条件直接跳出并提示)
            if (string.IsNullOrWhiteSpace(salaryDateString))
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定薪资月份,请选择。";
                infoList.Add(itemError);
                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            else
            {
                salaryDateString = salaryDateString + "/1";
                salaryDate = DateTimeHelper.Parse(salaryDateString, DateFormats.YMD);
            }

            if (enterpriseGuid == Guid.Empty)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "你没有选定企业的名称信息,请选择。";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }

            if (HttpPostedFileHelper.HasFile(postedFile) == false)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Warnning;
                itemError.Message = "没有选择Excel文件,请先选择文件然后再进行导入!";
                infoList.Add(itemError);

                this.TempData.Add("OperationResultData", infoList);
                return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
            }
            #endregion

            try
            {
                #region 将数据读入内存
                int userCountSuccessful = 0;
                int userCountFailure = 0;
                string userListFailure = string.Empty;
                DataTable dataTable = ExcelHelper.ReadExcel(postedFile.InputStream, headerRowNumber);
                NameValueCollection laborSalaryItemMapData = (NameValueCollection)ConfigurationManager.GetSection("laborSalaryItemMap");

                List<string> columnNameList = new List<string>();
                for (int i = 0; i < dataTable.Columns.Count; i++)
                {
                    columnNameList.Add(dataTable.Columns[i].ColumnName);
                }
                #endregion

                #region 对Excel的每行信息进行解析
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    int dataRowNumberInExcel = headerRowNumber + i + 1;
                    try
                    {
                        DataRow row = dataTable.Rows[i];
                        if (row == null)
                        {
                            continue;
                        }

                        string LaborUserNameCNForSalarySummary = string.Empty;
                        string LaborUserCodeForSalarySummary = string.Empty;
                        string LaborUserCardIDForSalarySummary = string.Empty;

                        Guid salarySummaryGuid = GuidHelper.NewGuid();
                        SalarySummaryEntity salarySummaryEntity = new SalarySummaryEntity();
                        salarySummaryEntity.SalarySummaryGuid = salarySummaryGuid;
                        salarySummaryEntity.SalaryDate = salaryDate;
                        salarySummaryEntity.CreateDate = DateTime.Today;
                        salarySummaryEntity.CreateUserKey = BusinessUserBLL.CurrentUserGuid.ToString();
                        salarySummaryEntity.EnterpriseKey = enterpriseGuid.ToString();
                        salarySummaryEntity.SalaryPayStatus = SalaryPayStatuses.PaidToOrgnization;
                        salarySummaryEntity.SalarySettlementStartDate = SettlementStartDate;
                        salarySummaryEntity.SalarySettlementEndDate = SettlementEndDate;

                        foreach (string columnName in columnNameList)
                        {
                            //0.处理特殊的标题头信息
                            if (columnName.Contains("[忽略]"))
                            {
                                continue;
                            }

                            //1.根据Excel文件中的列名称映射Labor实体的属性名称
                            string propertyName = laborSalaryItemMapData[columnName];
                            if (string.IsNullOrWhiteSpace(propertyName))
                            {
                                propertyName = columnName;
                            }

                            //2.给SalaryDetailsEntity实体属性赋值
                            object cellValue = row[columnName];
                            if (cellValue != null)
                            {
                                SalaryDetailsEntity salaryDetailsEntity = new SalaryDetailsEntity();
                                salaryDetailsEntity.SalarySummaryKey = salarySummaryGuid.ToString();

                                decimal salaryItemValue = Converter.ChangeType<decimal>(cellValue);
                                string columnNameEdited = columnName;
                                string nagetiveString = "[负值]";
                                string rebateBeforTaxString = "[先扣]";
                                string rebaseString = "[后扣]";
                                bool isRebateBeforeTax = false;

                                if (columnName.Contains(nagetiveString))
                                {
                                    salaryItemValue = 0 - Math.Abs(salaryItemValue);
                                    columnNameEdited = columnName.Remove(columnName.IndexOf(nagetiveString), nagetiveString.Length);
                                }

                                if (columnName.Contains(rebateBeforTaxString))
                                {
                                    columnNameEdited = columnNameEdited.Remove(columnNameEdited.IndexOf(rebateBeforTaxString), rebateBeforTaxString.Length);
                                    isRebateBeforeTax = true;
                                }

                                if (columnName.Contains(rebaseString))
                                {
                                    columnNameEdited = columnNameEdited.Remove(columnNameEdited.IndexOf(rebaseString), rebaseString.Length);
                                }

                                salaryDetailsEntity.SalaryItemKey = columnNameEdited;

                                switch (propertyName)
                                {
                                    case "UserNameCN":
                                        LaborUserNameCNForSalarySummary = cellValue.ToString();
                                        break;
                                    case "LaborCode":
                                        LaborUserCodeForSalarySummary = cellValue.ToString();
                                        break;
                                    case "UserCardID":
                                        LaborUserCardIDForSalarySummary = cellValue.ToString();
                                        break;
                                    case "EnterpriseMixCost":
                                        salarySummaryEntity.EnterpriseMixCostReal = salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseMixCost);
                                        break;
                                    case "EnterpriseInsurance":
                                        salarySummaryEntity.EnterpriseInsuranceReal = salaryItemValue;
                                        salarySummaryEntity.InsuranceCashDate = InsuranceCashDate;
                                        salaryDetailsEntity.SalaryItemCashDate = InsuranceCashDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseInsurance);
                                        break;
                                    case "EnterpriseReserveFund":
                                        salarySummaryEntity.EnterpriseReserveFundReal = salaryItemValue;
                                        salarySummaryEntity.ReserveFundCashDate = ReserveFundDate;
                                        salaryDetailsEntity.SalaryItemCashDate = ReserveFundDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseReserveFund);
                                        break;
                                    case "EnterpriseManageFee":
                                        salarySummaryEntity.EnterpriseManageFeeReal = salaryItemValue;
                                        salarySummaryEntity.EnterpriseManageFeeCashDate = ManageFeeCashDate;
                                        salaryDetailsEntity.SalaryItemCashDate = ManageFeeCashDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseManageFee);
                                        break;
                                    case "EnterpriseGeneralRecruitFee":
                                        salarySummaryEntity.EnterpriseGeneralRecruitFeeReal = salaryItemValue;
                                        salarySummaryEntity.EnterpriseGeneralRecruitFeeCashDate = GeneralRecruitDate;
                                        salaryDetailsEntity.SalaryItemCashDate = GeneralRecruitDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseGeneralRecruitFee);
                                        break;
                                    case "EnterpriseOnceRecruitFee":
                                        salarySummaryEntity.EnterpriseOnceRecruitFeeReal = salaryItemValue;
                                        salarySummaryEntity.EnterpriseOnceRecruitFeeCashDate = OnceRecruitDate;
                                        salaryDetailsEntity.SalaryItemCashDate = OnceRecruitDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseOnceRecruitFee);
                                        break;
                                    case "PersonMixCost":
                                        salarySummaryEntity.PersonMixCostReal = salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.PersonMixCost);
                                        break;
                                    case "PersonInsurance":
                                        salarySummaryEntity.PersonInsuranceReal = salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.PersonInsurance);
                                        break;
                                    case "PersonReserveFund":
                                        salarySummaryEntity.PersonReserveFundReal = salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.PersonReserveFund);
                                        break;
                                    case "PersonInsuranceAdditional":
                                        salarySummaryEntity.PersonOtherCostReal += salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.PersonalOtherFee);
                                        break;
                                    case "PersonInsuranceOverdueFee":
                                        salarySummaryEntity.PersonOtherCostReal += salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.PersonalOtherFee);
                                        break;
                                    case "PersonBorrow":
                                        salarySummaryEntity.PersonBorrow = salaryItemValue;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.PersonBorrow);
                                        break;
                                    case "EnterpriseOtherInsurance":
                                        salarySummaryEntity.EnterpriseOtherInsuranceReal += salaryItemValue;
                                        salarySummaryEntity.EnterpriseOtherInsuranceCashDate = OtherInsuranceCashDate;
                                        salaryDetailsEntity.SalaryItemCashDate = OtherInsuranceCashDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseOtherInsurance);
                                        break;
                                    case "EnterpriseTaxFee":
                                        salarySummaryEntity.EnterpriseTaxFeeReal += salaryItemValue;
                                        salarySummaryEntity.EnterpriseTaxFeeCashDate = TaxFeeCashDate;
                                        salaryDetailsEntity.SalaryItemCashDate = TaxFeeCashDate;
                                        SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.EnterpriseTaxFee);
                                        break;
                                    default:
                                        if (salaryItemValue >= 0)
                                        {
                                            salarySummaryEntity.SalaryGrossPay += salaryItemValue;
                                            SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.Rewards);
                                        }
                                        else
                                        {
                                            if (isRebateBeforeTax == true)
                                            {
                                                salarySummaryEntity.SalaryRebateBeforeTax += salaryItemValue;
                                            }
                                            else
                                            {
                                                salarySummaryEntity.SalaryRebate += salaryItemValue;
                                            }

                                            SetAndSaveSalaryDetailsItem(salaryItemValue, salaryDetailsEntity, SalaryItemKinds.Rebate);
                                        }
                                        break;
                                }
                            }
                        }

                        if (string.IsNullOrWhiteSpace(LaborUserNameCNForSalarySummary))
                        {
                            userCountFailure++;
                            userListFailure += string.Format("{0}({1}({2})({3})请确认此用户的用户名称不可以为空), <br />", dataRowNumberInExcel, LaborUserNameCNForSalarySummary, LaborUserCodeForSalarySummary, LaborUserCardIDForSalarySummary);
                            //物理删除掉已经插入的无效的salaryDetails数据
                            SalaryDetailsBLL.Instance.DeleteList(salarySummaryEntity.SalarySummaryGuid);
                        }
                        else
                        {
                            //根据人员姓名和工号,确认劳务人员的UserGuid
                            bool isMatchedLabor = false;
                            LaborEntity laborEntity = LaborBLL.Instance.Get(LaborUserNameCNForSalarySummary, LaborUserCodeForSalarySummary, LaborUserCardIDForSalarySummary, enterpriseGuid.ToString());
                            if (laborEntity.IsEmpty)
                            {
                                isMatchedLabor = false;
                            }
                            else
                            {
                                isMatchedLabor = true;
                            }

                            if (isMatchedLabor == true)
                            {
                                bool isSuccessful = true;
                                SalarySummaryEntity salarySummaryEntityConfirm = SalarySummaryBLL.Instance.Get(enterpriseGuid.ToString(), laborEntity.UserGuid.ToString(), salaryDate);
                                if (salarySummaryEntityConfirm.IsEmpty)
                                {
                                    salarySummaryEntity.LaborKey = laborEntity.UserGuid.ToString();
                                    salarySummaryEntity.LaborCode = LaborUserCodeForSalarySummary;
                                    salarySummaryEntity.LaborName = LaborUserNameCNForSalarySummary;

                                    //Logics isFirstCash = SalarySummaryBLL.Instance.IsFirstCash(enterpriseGuid.ToString(), laborEntity.UserGuid.ToString());
                                    //salarySummaryEntity.IsFirstCash = isFirstCash;
                                    isSuccessful = SalarySummaryBLL.Instance.Create(salarySummaryEntity);
                                }
                                else
                                {
                                    salarySummaryEntityConfirm.EnterpriseInsuranceReal += salarySummaryEntity.EnterpriseInsuranceReal;
                                    salarySummaryEntityConfirm.EnterpriseManageFeeReal += salarySummaryEntity.EnterpriseManageFeeReal;
                                    salarySummaryEntityConfirm.EnterpriseReserveFundReal += salarySummaryEntity.EnterpriseReserveFundReal;
                                    salarySummaryEntityConfirm.EnterpriseOtherCostReal += salarySummaryEntity.EnterpriseOtherCostReal;
                                    salarySummaryEntityConfirm.EnterpriseMixCostReal += salarySummaryEntity.EnterpriseMixCostReal;

                                    salarySummaryEntityConfirm.PersonInsuranceReal += salarySummaryEntity.PersonInsuranceReal;
                                    salarySummaryEntityConfirm.PersonManageFeeReal += salarySummaryEntity.PersonManageFeeReal;
                                    salarySummaryEntityConfirm.PersonReserveFundReal += salarySummaryEntity.PersonReserveFundReal;
                                    salarySummaryEntityConfirm.PersonOtherCostReal += salarySummaryEntity.PersonOtherCostReal;
                                    salarySummaryEntityConfirm.PersonMixCostReal += salarySummaryEntity.PersonMixCostReal;

                                    salarySummaryEntityConfirm.SalaryGrossPay += salarySummaryEntity.SalaryGrossPay;
                                    salarySummaryEntityConfirm.SalaryRebate += salarySummaryEntity.SalaryRebate;
                                    isSuccessful = SalarySummaryBLL.Instance.Update(salarySummaryEntityConfirm);
                                }

                                if (isSuccessful == true)
                                {
                                    userCountSuccessful++;
                                }
                                else
                                {
                                    userCountFailure++;
                                    userListFailure += i + ", ";
                                }
                            }
                            else
                            {
                                userCountFailure++;
                                userListFailure += string.Format("{0}({1}({2})({3})请确认此用户的用户名称、工号和身份证号是否跟系统内的数据一致), <br />", dataRowNumberInExcel, LaborUserNameCNForSalarySummary, LaborUserCodeForSalarySummary, LaborUserCardIDForSalarySummary);
                                //物联删除掉已经插入的无效的salaryDetails数据
                                SalaryDetailsBLL.Instance.DeleteList(salarySummaryEntity.SalarySummaryGuid);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //try
                        //{
                        //    BusinessLogEntity log = new BusinessLogEntity();
                        //    log.LogCategory = "BatchSalaryImport";
                        //    log.LogMessage = ExceptionHelper.GetExceptionMessage(ex);
                        //    log.LogDate = DateTime.Now;

                        //    BusinessLogBLL.Instance.Create(log);
                        //}
                        //catch
                        //{
                        //    //do nothing;
                        //}

                        userCountFailure++;
                        userListFailure += i + ", ";
                    }
                }
                #endregion

                #region 操作结果展示
                //A.1、操作结果(导入成功的人员信息)
                SystemStatusInfo itemSuccessful = new SystemStatusInfo();
                itemSuccessful.SystemStatus = SystemStatuses.Success;
                itemSuccessful.Message = string.Format("共有{0}人导入成功。", userCountSuccessful);
                infoList.Add(itemSuccessful);

                //A.2、操作结果(导入失败的人员信息)
                if (userCountFailure > 0)
                {
                    SystemStatusInfo itemError = new SystemStatusInfo();
                    itemError.SystemStatus = SystemStatuses.Failuer;
                    itemError.Message = string.Format("共有{0}人导入失败。", userCountFailure);
                    if (string.IsNullOrWhiteSpace(userListFailure) == false)
                    {
                        itemError.Message += string.Format("导入失败的人员分别位于{0}行, <br />", userListFailure);
                    }
                    infoList.Add(itemError);
                }
                #endregion
            }
            catch (OfficeXmlFileException)
            {
                SystemStatusInfo itemError = new SystemStatusInfo();
                itemError.SystemStatus = SystemStatuses.Failuer;
                itemError.Message = "请选择Excel2003格式的文件。你可以将本文件在Excel中另存的时候选择97/2003格式!";
                infoList.Add(itemError);
            }

            this.TempData.Add("OperationResultData", infoList);
            return RedirectToAction("OperationResults", "System", new { returnUrl = returnUrl });
        }