public ActionResult BusinessScope(string strucIDList)
        {
            var list = StructureBLL.GetBusinessScopeList();

            ViewBag.StrucIDList = strucIDList;
            return(PartialView("_BusinessScope", list));
        }
        public ActionResult TransportIndustry(string strucIDList)
        {
            var list = StructureBLL.GetTransportIndustryList();

            ViewBag.StrucIDList = strucIDList;
            return(PartialView("_TransportIndustry", list));
        }
        public ActionResult DistributionTransportIndustry(string strucIDList, string codeList)
        {
            var result = StructureBLL.DistributionTransportIndustry(strucIDList, codeList);

            base.DoLog(OperationTypeEnum.Edit, result, strucIDList);
            return(Json(result));
        }
        public ActionResult GetCurrentOrParentLogo(int id)
        {
            base.FixVaryBug();
            byte[] bts = StructureBLL.GetCurrentOrParentLogoBytes(id);
            //string defaultPath = Server.MapPath("~/Content/images/login/logo.png");
            string defaultPath = Server.MapPath("~/Content/images/login/AsiatekLOGO.png");

            if (bts == null)
            {
                return(File(defaultPath, "image/png"));
            }
            else
            {
                try
                {
                    MemoryStream memStream = new MemoryStream(bts);
                    Image        img       = Image.FromStream(memStream, true);
                    return(File(bts, "image/" + img.GetImageExtension() + ""));
                }
                catch
                {
                    return(File(defaultPath, "image/png"));
                }
            }
        }
        public ActionResult NightBan(string strucIDList, int isNightBan)
        {
            var result = StructureBLL.NightBan(strucIDList, isNightBan);

            base.DoLog(OperationTypeEnum.Edit, result, strucIDList);
            return(Json(result));
        }
        public ActionResult DistributionBusinessScope(string strucIDList, string codeList)
        {
            var result = StructureBLL.DistributionBusinessScope(strucIDList, codeList);

            base.DoLog(OperationTypeEnum.Edit, result, strucIDList);
            return(Json(result));
        }
 public ActionResult CheckEditCustomEncodingExists(string customEncoding, int id)
 {
     if (string.IsNullOrWhiteSpace(customEncoding))
     {
         return(Json(true));
     }
     return(Json(!StructureBLL.CheckEditCustomEncodingExists(customEncoding, id)));
 }
        public ActionResult GetStructureLogo(int id)
        {
            byte[]       bts       = StructureBLL.GetLogBytes(id);
            MemoryStream memStream = new MemoryStream(bts);
            Image        img       = Image.FromStream(memStream, true);

            return(File(bts, "image/" + img.GetImageExtension() + ""));
        }
 public ActionResult CheckEditStrucLicenseNoExists(string licenseNo, int id)
 {
     if (string.IsNullOrWhiteSpace(licenseNo))
     {
         return(Json(true));
     }
     return(Json(!StructureBLL.CheckStrucLicenseNoExists(licenseNo, id)));
 }
Exemple #10
0
        public ActionResult DeleteStruc(FormCollection fc)
        {
            string[] ids = fc["strucid"].Split(',');

            //var result = StructureBLL.DeleteStrus(ids);
            var result = StructureBLL.DeleteStrusPhysical(ids);

            base.DoLog(OperationTypeEnum.Delete, result, fc["strucid"]);
            return(Json(result));
        }
Exemple #11
0
        [AsiatekSubordinateFunction("MaintenanceScheduleSetting", "MaintenanceSchedule", "Admin")]        //4.保养方案设定
        public ActionResult GetStructuresByName(string name)
        {
            var            list       = StructureBLL.GetUsersStructuresByName(name, base.CurrentStrucID);
            List <dynamic> resultList = new List <dynamic>();

            foreach (var item in list)
            {
                resultList.Add(new { label = item.StrucName, value = item.StrucName, ID = item.ID });
            }
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }
Exemple #12
0
        //public ActionResult StructureSetting()
        //{
        //    StructureSettingModel model = new StructureSettingModel();
        //    model.IsCascaded = true;
        //    model.InspectTypeAny = true;
        //    model.ExNoticeTypeAny = true;
        //    model.PagedStructures = StructureBLL.GetPagedStructures(model, this.PageSize);
        //    return PartialView("_StructureSetting", model);
        //}

        //private ActionResult GetStructurePagedGridPV(StructureSettingModel model, int currentPage)
        //{
        //    model.PagedStructures = StructureBLL.GetPagedStructures(model, this.PageSize, currentPage);
        //    return PartialView("_StructureSetting", model);
        //}


        //public ActionResult StructurePagedGrid(StructureSettingModel model, int currentPage)
        //{
        //    return GetStructurePagedGridPV(model, currentPage);
        //}


        //[HttpPost, ValidateAntiForgeryToken]
        //public ActionResult GetStructureInfo(StructureSettingModel model)
        //{
        //    return GetStructurePagedGridPV(model, 1);
        //}
        #endregion
        public ActionResult StructureSetting()
        {
            StructureSettingModel model = new StructureSettingModel();

            model.IsCascaded      = false;
            model.InspectTypeAny  = true;
            model.ExNoticeTypeAny = true;
            model.SearchPage      = 1;
            model.Nightban        = -1;
            model.PagedDatas      = StructureBLL.GetPagedStructures(model, this.PageSize);
            return(PartialView("_StructureSetting", model));
        }
Exemple #13
0
        public ActionResult GetStructuresByStructureName(string structuresName)
        {
            base.FixVaryBug();
            var            list       = StructureBLL.GetStructuresByStructureName(structuresName);
            List <dynamic> resultList = new List <dynamic>();

            foreach (var item in list)
            {
                resultList.Add(new { value = item.StrucName, label = item.StrucName, ID = item.ID });
            }
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }
Exemple #14
0
        public ActionResult EditStructureInfo(int id)
        {
            var obj = StructureBLL.GetStructureByID(id);

            if (obj.DataResult == null)
            {
                return(Content(obj.Message));
            }
            var model = obj.DataResult;

            model.ModifyLogo = false;
            //model.ParentStructureSelectList = StructureBLL.GetStructures(id).ToSelectListWithEmpty(m => GetSelectListItem(m.ID, m.StrucName));
            return(PartialView("_EditStructureInfo", model));
        }
Exemple #15
0
        public ActionResult AddSubStrucToCurrentStruc(StructureAddSubModel model)
        {
            //暂时没有做相应的验证特性,进行手动验证
            //一个地图类型都没有选
            if (!(model.MapType1 || model.MapType2 || model.MapType3))
            {
                ModelState.AddModelError("MapType1", DataAnnotations.StructureMustSelectMapType);
            }
            //上传了LOGO文件则验证logo格式与大小 只能是png或jpg 最大1M
            if (model.LogoFile != null)
            {
                Regex reg = new Regex(@"\.(png|PNG|jpg|JPG|jpeg|jpeg)$");

                if (!reg.IsMatch(model.LogoFile.FileName))
                {
                    ModelState.AddModelError("LogoFile", DataAnnotations.LogoTypeError);
                }
                else if (model.LogoFile.ContentLength > 1024 * 1024)
                {
                    ModelState.AddModelError("LogoFile", DataAnnotations.LogoSizeError);
                }
            }


            if (ModelState.IsValid)
            {
                if (model.LogoFile != null)
                {
                    //将图片转换为字节数组
                    int    logoLength = model.LogoFile.ContentLength;
                    byte[] logoBytes  = new byte[logoLength];
                    model.LogoFile.InputStream.Read(logoBytes, 0, logoLength);
                    model.Logo = logoBytes;
                }


                var result = StructureBLL.AddStructure(model);
                base.DoLog(OperationTypeEnum.Add, result, "StrucName:" + model.StrucName);
                return(Json(result));
            }
            else
            {
                return(PartialView("_AddSubStructureInfo", model));
            }
        }
Exemple #16
0
        public ActionResult EditStructureInfo(StructureEditModel model)
        {
            //暂时没有做相应的验证特性,进行手动验证
            //一个地图类型都没有选
            if (!(model.MapType1 || model.MapType2 || model.MapType3))
            {
                ModelState.AddModelError("MapType1", DataAnnotations.StructureMustSelectMapType);
            }
            //上传了LOGO文件则验证logo格式与大小 只能是png或jpg 最大1M
            if (model.LogoFile != null)
            {
                Regex reg = new Regex(@"\.(png|PNG|jpg|JPG|JPEG|jpeg)$");

                if (!reg.IsMatch(model.LogoFile.FileName))
                {
                    ModelState.AddModelError("LogoFile", DataAnnotations.LogoTypeError);
                }
                else if (model.LogoFile.ContentLength > 1024 * 1024)
                {
                    ModelState.AddModelError("LogoFile", DataAnnotations.LogoSizeError);
                }
            }
            if (ModelState.IsValid)
            {
                if (model.LogoFile != null)
                {
                    //将图片转换为字节数组
                    int    logoLength = model.LogoFile.ContentLength;
                    byte[] logoBytes  = new byte[logoLength];
                    model.LogoFile.InputStream.Read(logoBytes, 0, logoLength);
                    model.Logo = logoBytes;
                }
                var result = StructureBLL.EditStructure(model, base.UserIDForLog);
                base.DoLog(OperationTypeEnum.Edit, result, "StructureID:" + model.ID + "|StrucCode:" + model.StrucAccount);
                return(Json(result));
            }
            else
            {
                //model.ParentStructureSelectList = StructureBLL.GetStructures(model.ID).ToSelectListWithEmpty(m => GetSelectListItem(m.ID, m.StrucName));
                model.ModifyLogo = false;
                return(PartialView("_EditStructureInfo", model));
            }
        }
Exemple #17
0
        public ActionResult GetDistributiveStrucsByUserID(int uid)
        {
            var allStrucs    = StructureBLL.GetStructuresForTree();
            var userStrucIDs = StructureBLL.GetDistributiveStrucIDByUserID(uid);
            var parentStruc  = allStrucs.Where(s => s.ParentID == null);
            List <BootstrapTreeViewNode> nodes = new List <BootstrapTreeViewNode>();

            foreach (var item in parentStruc)
            {
                var temp = new BootstrapTreeViewNode()
                {
                    text  = item.StrucName,
                    tag   = item.ID,
                    state = new BootstrapTreeViewNodeState()
                    {
                        expanded = true,
                        @checked = userStrucIDs.SingleOrDefault(id => id == item.ID) != null
                    }
                };
                CreateSubTreeNode(temp, item.ID, allStrucs, userStrucIDs);
                nodes.Add(temp);
            }
            return(Json(nodes, JsonRequestBehavior.AllowGet));
        }
Exemple #18
0
 public ActionResult CheckAddStrucNameExists(string strucName)
 {
     return(Json(!StructureBLL.CheckStrucNameExists(strucName)));
 }
Exemple #19
0
        /// <summary>
        /// 检查导入的sim资料合法性
        /// </summary>
        private static bool CheckImportSimInfo(DataRow currentRow, List <string> errorMessages, List <string> SimCodes, AddSimCodeModels model)
        {
            string fieldName = string.Empty;

            #region 获取当前行数据
            string SimCodeStr         = currentRow[0].ToString().Trim(); //                    Sim卡号
            string CommModeStr        = currentRow[1].ToString().Trim(); //                 通信方式
            string OwnerStrucNameStr  = currentRow[2].ToString().Trim(); //                  归属单位
            string UseStrucNameStr    = currentRow[3].ToString().Trim(); //               使用单位
            string ServiceProviderStr = currentRow[4].ToString().Trim(); //              服务商
            string PurchaseDateStr    = currentRow[5].ToString().Trim(); //               购买日期
            string OpeningDateStr     = currentRow[6].ToString().Trim(); //                 开通日期
            string ExpiryDateStr      = currentRow[7].ToString().Trim(); //               过期日期
            string RemarkStr          = currentRow[8].ToString().Trim(); //              备注
            #endregion

            #region 检查Sim卡号
            fieldName = DisplayText.SIMCode;
            Regex reg = new Regex(@"^([0-9]{11}|[0-9]{13})$");

            if (string.IsNullOrWhiteSpace(SimCodeStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
            }
            //检查Sim卡格式
            else if (!reg.IsMatch(SimCodeStr))
            {
                errorMessages.Add(DataAnnotations.SIMCodeError);
            }
            //检查Sim卡在excel中是否重复
            else if (SimCodes.Exists(sc => sc == SimCodeStr))
            {
                errorMessages.Add(PromptInformation.SameSIMInExcel + ":" + SimCodeStr);
            }
            //检查Sim卡在数据库中是否重复
            else if (CheckSIMCodeExists(SimCodeStr))
            {
                errorMessages.Add(string.Format(DataAnnotations.FieldExists, fieldName));
            }
            else
            {
                SimCodes.Add(SimCodeStr);
            }
            #endregion

            #region 通信方式
            fieldName = DisplayText.CommMode;
            int CommModeValue = -1;
            if (string.IsNullOrWhiteSpace(CommModeStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
            }
            //检查通信方式合法性
            else if (!CommunicationTypeBLL.TryGetCodeByName(CommModeStr, out CommModeValue))
            {
                errorMessages.Add(string.Format("{0}:{1}{2}", fieldName, CommModeStr, PromptInformation.NotExists));
            }
            #endregion


            #region 归属单位
            fieldName = DisplayText.OwnerStrucCode;
            int OwnerStrucID = -1;
            if (string.IsNullOrWhiteSpace(OwnerStrucNameStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
            }
            //检查单位名是否存在,并且获取真正的单位ID
            else if (!StructureBLL.TryGetStructureIDByName(OwnerStrucNameStr, out OwnerStrucID))
            {
                errorMessages.Add(string.Format("{0}:{1}{2}", fieldName, OwnerStrucNameStr, PromptInformation.NotExists));
            }
            #endregion

            #region 使用单位
            fieldName = DisplayText.UseStrucCode;
            int UseStrucID = -1;
            if (string.IsNullOrWhiteSpace(UseStrucNameStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
            }
            //检查单位名是否存在,并且获取真正的单位ID
            else if (!StructureBLL.TryGetStructureIDByName(UseStrucNameStr, out UseStrucID))
            {
                errorMessages.Add(string.Format("{0}:{1}{2}", fieldName, UseStrucNameStr, PromptInformation.NotExists));
            }
            #endregion

            #region  务商
            fieldName = DisplayText.ServiceProvider;
            int ServiceProviderValue = -1;
            if (string.IsNullOrWhiteSpace(ServiceProviderStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
            }
            //检查服务商合法性
            else if (!ServiceProviderTypeBLL.TryGetCodeByName(ServiceProviderStr, out ServiceProviderValue))
            {
                errorMessages.Add(string.Format("{0}:{1}{2}", fieldName, ServiceProviderStr, PromptInformation.NotExists));
            }
            #endregion

            #region 购买日期
            fieldName = DisplayText.PurchaseDate;
            DateTime PurchaseDateValue   = DateTime.Today;
            bool     PurchaseDateIsVaild = true;
            if (string.IsNullOrWhiteSpace(PurchaseDateStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
                PurchaseDateIsVaild = false;
            }
            else if (!DateTime.TryParse(PurchaseDateStr, out PurchaseDateValue))
            {
                errorMessages.Add(fieldName + " " + DataAnnotations.DateError);
                PurchaseDateIsVaild = false;
            }
            #endregion

            #region 开通日期
            fieldName = DisplayText.OpeningDate;
            DateTime OpeningDateValue   = DateTime.Today;
            bool     OpeningDateIsVaild = true;
            if (string.IsNullOrWhiteSpace(OpeningDateStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
                OpeningDateIsVaild = false;
            }
            else if (!DateTime.TryParse(OpeningDateStr, out OpeningDateValue))
            {
                errorMessages.Add(fieldName + " " + DataAnnotations.DateError);
                OpeningDateIsVaild = false;
            }
            else if (PurchaseDateIsVaild &&
                     OpeningDateValue.Subtract(PurchaseDateValue).TotalMilliseconds < 0)
            {
                errorMessages.Add(fieldName + DataAnnotations.NotLessThan + DisplayText.PurchaseDate);
            }
            #endregion

            #region 过期日期
            fieldName = DisplayText.ExpiryDate;
            DateTime ExpiryDateValue = DateTime.Today;
            if (string.IsNullOrWhiteSpace(ExpiryDateStr))
            {
                errorMessages.Add(PromptInformation.MissingField + fieldName);
            }
            else if (!DateTime.TryParse(ExpiryDateStr, out ExpiryDateValue))
            {
                errorMessages.Add(fieldName + " " + DataAnnotations.DateError);
            }
            else if (PurchaseDateIsVaild && OpeningDateIsVaild &&
                     ExpiryDateValue.Subtract(PurchaseDateValue).TotalMilliseconds < 0 ||
                     ExpiryDateValue.Subtract(OpeningDateValue).TotalMilliseconds < 0)
            {
                errorMessages.Add(fieldName + DataAnnotations.NotLessThan + DisplayText.PurchaseDate + DataAnnotations.Or + DisplayText.OpeningDate);
            }
            #endregion

            model.SimCode           = SimCodeStr;
            model.CommMode          = CommModeValue;
            model.OwnerStrucID      = OwnerStrucID;
            model.UseStrucID        = UseStrucID;
            model.ServiceProviderID = ServiceProviderValue;
            model.PurchaseDate      = PurchaseDateValue.ToString("yyyy-MM-dd");
            model.OpeningDate       = OpeningDateValue.ToString("yyyy-MM-dd");
            model.ExpiryDate        = ExpiryDateValue.ToString("yyyy-MM-dd");
            model.Remark            = RemarkStr;
            model.Status            = "0";

            return(errorMessages.Count == 0);
        }
Exemple #20
0
 private ActionResult GetStructurePagedGridPV(StructureSettingModel model)
 {
     model.PagedDatas = StructureBLL.GetPagedStructures(model, this.PageSize);
     return(PartialView("_StructurePagedGrid", model));
 }
Exemple #21
0
 //[OutputCache(Location = System.Web.UI.OutputCacheLocation.Server, Duration = Int32.MaxValue, SqlDependency = "asiatekCache:Structures")]
 public ActionResult GetStructures()
 {
     base.FixVaryBug();
     return(Json(StructureBLL.GetStructures(), JsonRequestBehavior.AllowGet));
 }
Exemple #22
0
 public ActionResult CheckAddStrucAccountExists(string strucAccount)
 {
     return(Json(!StructureBLL.CheckStrucAccountExists(strucAccount)));
 }
Exemple #23
0
        public ActionResult SearchTransportIndustry(int id)
        {
            var result = StructureBLL.GetTransportIndustryListByStrucID(id);

            return(PartialView("_SearchSearchTransportIndustry", result));
        }
Exemple #24
0
 public ActionResult CheckEditStrucNameExists(string strucName, int id)
 {
     return(Json(!StructureBLL.CheckStrucNameExists(strucName, id)));
 }
Exemple #25
0
        public ActionResult GetStrucListByUserID()
        {
            int uid = base.CurrentUserID;

            return(Json(StructureBLL.GetStructuresByUserID(uid), JsonRequestBehavior.AllowGet));
        }
Exemple #26
0
        public ActionResult SearchBusinessScope(int id)
        {
            var result = StructureBLL.GetBusinessScopeListByStrucID(id);

            return(PartialView("_SearchBusinessScope", result));
        }