public override ActionResult AppAdd(string appProjectId, bool? IsUpdate)
        {
            NAppProject appProject = new NAppProject();

            ViewData["AllIntegrators"] = new SelectList(RedisService.GetAllSubModelsByType<DesignCompany, Integrator>(UserAccessDataControlService.GetCurrentDesignCompanyId()).OrderBy(s => s.Name), "Id", "Name");

            if (!string.IsNullOrWhiteSpace(appProjectId))
            {
                appProject = RedisService.Get<NAppProject>(appProjectId);
            }
            if (IsUpdate.GetValueOrDefault())
            {
                ViewData["Operator"] = appProject.Operators;
            }
            else
            {
                ViewData["Operator"] = string.Empty;
            }
            ViewData["AllElements"] = GetAllAttributes();
            ViewData["IsUpdate"] = IsUpdate.GetValueOrDefault();
            ViewData["AllDesignCompanies"] = new SelectList(UserAccessDataControlService.GetDesignCompaniesByUser(Membership.GetUser().UserName), "Id", "Name");
            return View(appProject);
        }
        public ActionResult AppAdd(NAppProject model, HttpPostedFileBase LogoFile, string designCompanyName)
        {
            var operators = Request.Form["Operator"];

            if (!string.IsNullOrEmpty(designCompanyName) && !string.IsNullOrEmpty(model.Name) && !string.IsNullOrEmpty(operators))
            {
                var productNo = model.Name.ToLower().Trim();
                model.ProductNo = productNo;
                model.AppNo = model.ProductNo;
                model.Operators = operators;
                var acitionResult = AddNAppProject(model, LogoFile);
                var designCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(true);
                UserAccessDataControlService.AddNAppProjectToDesignCompany(model.Id, designCompanyId);
                RedisService.SetEntryInHash<string>(CacheKeys.OTA_PRODUCT_FOR_DESIGN_COMPAY, model.ProductNo, designCompanyId.MakeSureNotNull());
                return acitionResult;

            }
            TempData["errorMsg"] = string.Format("所有输入都是必须的,并且必须是英文字符与数字!");
            if (!string.IsNullOrEmpty(Request.Form["IsUpdate"]))
            {
                return RedirectToAction("AppAdd", new { appProjectId = model.Id, IsUpdate = true });
            }
            else
            {
                return RedirectToAction("AppAdd");
            }
        }
        private ActionResult AddNAppProject(NAppProject model, HttpPostedFileBase LogoFile)
        {
            if (!ValidateModel())
            {
                if (!string.IsNullOrEmpty(Request.Form["IsUpdate"]))
                {
                    return RedirectToAction("AppAdd", new { appProjectId = model.Id, IsUpdate = true });
                }
                else
                {
                    return RedirectToAction("AppAdd");
                }
            }

            if (UIService.GetAppProjectByAppNo(model.AppNo) != null && string.IsNullOrEmpty(Request.Form["IsUpdate"]))
            {
                TempData["errorMsg"] = string.Format("Duplicate App No detected.");
                return RedirectToAction("AppAdd");
            }

            if (Request.Form["IsUpdate"].ToBoolean())
            {
                var updateAppProject = RedisService.Get<NAppProject>(model.Id);
                if (!string.IsNullOrEmpty(updateAppProject.LogoFile))
                {
                    model.LogoFile = updateAppProject.LogoFile;
                }
            }

            if (LogoFile != null)
            {
                var logoFilePath = SaveResourceFile("AppLogos", ResourcesFilePathHelper.AppLogoPath, LogoFile, string.Format("{0}_{1}_{2}", model.AppNo, Guid.NewGuid().ToString(), Path.GetExtension(LogoFile.FileName)).NormalzieFileName());
                model.LogoFile = Path.GetFileName(logoFilePath);
            }

            model.CurrentVersion = 1;
            model.CreateDateTime = DateTime.Now;

            if (!string.IsNullOrEmpty(Request.Form["IsUpdate"]))
            {
                var originalModel = RedisService.Get<NAppProject>(model.Id);
                RedisService.UpdateWithRebuildIndex<NAppProject>(originalModel, model);
            }
            else
            {
                if (string.IsNullOrEmpty(RedisService.Add<NAppProject>(model)))
                {
                    TempData["errorMsg"] = string.Format("Save App error, please check if there is duplicate app name.");
                    return RedirectToAction("AppAdd");
                }
            }

            return RedirectToAction("AppManage");
        }