示例#1
0
        /// <summary>
        /// Creates scene helper
        /// </summary>
        private void createSceneHelper()
        {
            var go = new GameObject();

            go.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;// | HideFlags.HideInHierarchy;

            helper               = go.AddComponent <PresentationHelper>();
            helper.Frame        += frameHandler;
            helper.NextSlide     = props.NextSlide;
            helper.PreviousSlide = props.PreviousSlide;
            helper.Previous     += previousSlideHandler;
            helper.Next         += nextSlideHandler;
        }
        internal bool StopEditing()
        {
            if (_EditedItem == null)
            {
                return(false);
            }

            Keyboard.Focus(_EditedItem);
            _EditedItem.IsEditing = false;
            PresentationHelper.ForceFocus(_EditedItem);
            _EditedItem = null;
            return(true);
        }
示例#3
0
        /// <summary>
        /// 获取楼层模型
        /// </summary>
        /// <returns></returns>
        public SWfsIndexModule GetEmptySWfsIndexModuleModel()
        {
            SWfsIndexModule ClassfiedFloor = new SWfsIndexModule();
            DateTime        now            = DateTime.Now;

            ClassfiedFloor.Stutas               = 1;
            ClassfiedFloor.UpdateDate           = MinTime;
            ClassfiedFloor.DateCreate           = DateTime.Now;
            ClassfiedFloor.OperateUserId        = PresentationHelper.GetPassport().UserName;
            ClassfiedFloor.ModuleName           = "";
            ClassfiedFloor.DataState            = 1;
            ClassfiedFloor.UpdateDate           = MinTime;
            ClassfiedFloor.ADShowTypeChangeDate = MinTime;
            return(ClassfiedFloor);
        }
示例#4
0
        //发布产品编辑内容
        public int PublishProductContent(int publishID)
        {
            if (publishID == 0)
            {
                return(0);
            }
            Passport passport = PresentationHelper.GetPassport();

            return(DapperUtil.Execute("ComBeziWfs_SWfsProductRef_PublishProductRefHtmlCodeByRefID", new
            {
                RefID = publishID,
                PublishTime = DateTime.Now,
                PublishPeople = (passport != null?passport.UserName:"")
            }));
        }
示例#5
0
 /// <summary>
 /// 保存活动(使用新的活动lxy)
 /// </summary>
 /// <param name="activityId"></param>
 /// <returns></returns>
 public ActionResult TopicRefCreate(SWfsVActivityTopicsRef obj, string activityId)
 {
     if (Request.Form["cb_KeyID"] != null)
     {
         obj.ActivityId = Request.Form["activityIds"];
         obj.OperatorId = PresentationHelper.GetPassport().UserName;
         obj.DateCreate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").Replace("/", ""));
         string[] arry = Request.Form["cb_KeyID"].Split(',');
         for (int i = 0; i < arry.Length; i++)
         {
             obj.TopicNo = arry[i];
             Vcode.TopicsRefCreate(obj);
         }
     }
     return(Content("<script>alert('关联成功'); window.location.href='/Shangpin/VCode/RelatedTopicsListV.html?activityId=" + obj.ActivityId + "'</script>"));
 }
示例#6
0
        /// <summary>
        /// 获取链接模型
        /// </summary>
        /// <returns></returns>
        public SWfsIndexModuleLink GetEmptySWfsIndexModuleLinkModel()
        {
            SWfsIndexModuleLink link = new SWfsIndexModuleLink();

            link.CategoryNo    = string.Empty;
            link.DateCreate    = DateTime.Now;
            link.UpdateDate    = MinTime;
            link.OperateUserId = PresentationHelper.GetPassport().UserName;

            link.UpdateDate          = MinTime;
            link.UpdateDate          = Convert.ToDateTime("1991/02/10 01:01:00");
            link.UpdateOperateUserId = PresentationHelper.GetPassport().UserName;
            link.Stutas    = 1;
            link.DataState = 1;
            return(link);
        }
示例#7
0
        /// <summary>
        /// 获取图片模型
        /// </summary>
        /// <returns></returns>
        public SWfsOperationPicture GetEmptySWfsOperationPictureModel()
        {
            SWfsOperationPicture pic = new SWfsOperationPicture();

            pic.PictureName      = "";
            pic.LinkAddress      = "";
            pic.DataState        = (short)1;
            pic.Status           = 1;
            pic.OperatorUserId   = PresentationHelper.GetPassport().UserName;
            pic.DateCreate       = DateTime.Now;
            pic.LinkAddress      = "";
            pic.PagePositionName = "";
            pic.DateBegin        = MinTime;
            pic.DateEnd          = MinTime;
            return(pic);
        }
示例#8
0
        //获取历史记录
        public IEnumerable <SWfsProductSearchHistory> GetSearchHistory(int count)
        {
            IEnumerable <SWfsProductSearchHistory> list = new List <SWfsProductSearchHistory>();
            Passport passport = PresentationHelper.GetPassport();

            if (passport != null)
            {
                if (!string.IsNullOrEmpty(passport.UserName))
                {
                    //查询历史记录
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("getCount", count);
                    list = DapperUtil.Query <SWfsProductSearchHistory>("ComBeziWfs_SWfsProductSearchHistory_GetProductSearchHistory", dic, new { SearchUser = passport.UserName });
                }
            }
            return(list);
        }
示例#9
0
        //编辑商品推荐内容
        public int EditeProductRefContent(SWfsProductRef obj)
        {
            if (obj.TemplateNO == null)
            {
                obj.TemplateNO = "";
            }
            Passport passport = PresentationHelper.GetPassport();

            return(DapperUtil.UpdatePartialColumns <SWfsProductRef>(new
            {
                RefID = obj.RefID,
                EditeDate = DateTime.Now,
                EditePeople = (passport == null?"":passport.UserName),
                HTMLCode = obj.HTMLCode,
                HTMLCodeMobile = obj.HTMLCodeMobile,
            }) ? 1 : 0);
        }
示例#10
0
        /// <summary>
        /// ajax添加商品
        /// </summary>
        /// <param name="ProductNoStr"></param>
        /// <param name="NewArrivalId"></param>
        /// <param name="IsOneRow"></param>
        /// <returns></returns>
        public ActionResult AddShelfProduct(string ProductNoStr, string ArrivalId, string IsOneRow)
        {
            SwfsFlagShipNewArrivalProductService service = new SwfsFlagShipNewArrivalProductService();
            Passport passport = PresentationHelper.GetPassport();//用户

            try
            {
                service.AddShelfProduct(ProductNoStr, passport.UserName, ArrivalId, IsOneRow);
                return(Json(new { message = "添加成功" }));
            }
            catch (Exception)
            {
                return(Json(new { message = "添加失败" }));

                throw;
            }
        }
示例#11
0
        /// <summary>
        /// Destroys current scene helper
        /// </summary>
        private void destroySceneHelper()
        {
            if (helper == null)
            {
                return;
            }

            if (Application.isPlaying)
            {
                Destroy(helper.gameObject);
            }
            else
            {
                DestroyImmediate(helper.gameObject);
            }
            helper = null;
        }
        public void SelectNextFromKey()
        {
            TreeViewExItem item = GetFocusedItem();

            item = TreeViewElementFinder.FindNext(item, true);
            if (item == null)
            {
                return;
            }

            // if ctrl is pressed just focus it, so it can be selected by space. Otherwise select it.
            if (!IsControlKeyDown)
            {
                SelectSingleItem(item);
            }

            PresentationHelper.ForceFocus(item);
        }
示例#13
0
        //把商品加入推荐池
        public ActionResult AddProductToAppRecommondAjax()
        {
            string productNO = Request.Form["productNo"];

            if (string.IsNullOrEmpty(productNO))
            {
                TempData["tip"] = "<script>alert('添加失败')</script>";
                return(Redirect("/Shangpin/AppRecommendProductManger/Index?categoryNO=" + Request.QueryString["categoryNO"] + "&ProductNo=" + Request.QueryString["ProductNo"] + "&ProductName=" + Request.QueryString["ProductName"] + "&brandNO=" + Request.QueryString["brandNO"] + "&colorId=" + Request.QueryString["colorId"] + "&shelfType=" + Request.QueryString["shelfType"] + "&ShelfDate=" + Request.QueryString["ShelfDate"] + "&MinPrice=" + Request.QueryString["MinPrice"] + "&MaxPrice=" + Request.QueryString["MaxPrice"] + "&MinStock=" + Request.QueryString["MinStock"] + "&MaxStock=" + Request.QueryString["MaxStock"] + "&MinDiscountRate=" + Request.QueryString["MinDiscountRate"] + "&MaxDiscountRate=" + Request.QueryString["MaxDiscountRate"] + "&hot=" + Request.QueryString["hot"] + "&sevenHot=" + Request.QueryString["sevenHot"]));
            }
            SWfsSortHistoryService sshsDal = new SWfsSortHistoryService();
            Passport passport = PresentationHelper.GetPassport();

            AppRecommendService             zhao            = new AppRecommendService();
            List <AppRecommendProductModle> saveProductList = zhao.GetAppRecommendProductList();

            if ((saveProductList.Count + productNO.Split(',').Length) > 50)
            {
                int remoteIndex = 0;
                remoteIndex = (saveProductList.Count + productNO.Split(',').Length) - 50;
                for (int i = 0; i < saveProductList.Count; i++)
                {
                    if (i < remoteIndex)
                    {
                        zhao.DelAppRecommendProductById(saveProductList[i].ProductNo);
                    }
                }
            }
            int result = 0;

            for (int i = 0; i < productNO.Split(',').Length; i++)
            {
                AppRecommendProductModle DTO = new AppRecommendProductModle()
                {
                    ProductNo = productNO.Split(',')[i],
                    Creator   = passport.UserName
                };
                result = zhao.AddAppRecommendProduct(DTO);
            }

            sshsDal         = null;
            TempData["tip"] = "<script>alert('添加成功')</script>";
            return(Redirect("/Shangpin/AppRecommendProductManger/Index?categoryNO=" + Request.QueryString["categoryNO"] + "&ProductNo=" + Request.QueryString["ProductNo"] + "&ProductName=" + Request.QueryString["ProductName"] + "&brandNO=" + Request.QueryString["brandNO"] + "&colorId=" + Request.QueryString["colorId"] + "&shelfType=" + Request.QueryString["shelfType"] + "&ShelfDate=" + Request.QueryString["ShelfDate"] + "&MinPrice=" + Request.QueryString["MinPrice"] + "&MaxPrice=" + Request.QueryString["MaxPrice"] + "&MinStock=" + Request.QueryString["MinStock"] + "&MaxStock=" + Request.QueryString["MaxStock"] + "&MinDiscountRate=" + Request.QueryString["MinDiscountRate"] + "&MaxDiscountRate=" + Request.QueryString["MaxDiscountRate"] + "&hot=" + Request.QueryString["hot"] + "&sevenHot=" + Request.QueryString["sevenHot"]));
        }
        public void SelectPreviousFromKey()
        {
            List <TreeViewExItem> items = TreeViewElementFinder.FindAll(treeViewEx, true).ToList();
            TreeViewExItem        item  = GetFocusedItem();

            item = treeViewEx.GetPreviousItem(item, items);
            if (item == null)
            {
                return;
            }

            // if ctrl is pressed just focus it, so it can be selected by space. Otherwise select it.
            if (!IsControlKeyDown)
            {
                SelectSingleItem(item);
            }

            PresentationHelper.ForceFocus(item);
        }
示例#15
0
        public IncorrectMethodSignatureQuickFix(InvalidStaticModifierWarning warning)
            : this(warning.MethodDeclaration, warning.ExpectedMethodSignature,
                   MethodSignatureMatch.IncorrectStaticModifier)
        {
            var language   = myMethodDeclaration.Language;
            var staticTerm = PresentationHelper.GetHelper(language).GetStaticTerm();

            if (myExpectedMethodSignature.IsStatic == true)
            {
                var declaredElement = myMethodDeclaration.DeclaredElement;
                Assertion.AssertNotNull(declaredElement, "declaredElement != null");
                var methodName = DeclaredElementPresenter.Format(language, DeclaredElementPresenter.NAME_PRESENTER,
                                                                 declaredElement);
                Text = $"Make '{methodName}' {staticTerm}";
            }
            else
            {
                Text = $"Remove '{staticTerm}' modifier";
            }
        }
示例#16
0
 public bool UpdateASWfsProductCommentStatus(int verify, int commentId, int status)
 {
     if (status == 0)
     { //隐藏状态,已经审核通过,某种原因把它隐藏了。所以修改为审核通过显示状态
         return(DapperUtil.UpdatePartialColumns <SWfsProductComment>(new { CommentId = commentId, Status = 1 }));
     }
     else if (status == 1)
     { //显示状态,只能隐藏
         return(DapperUtil.UpdatePartialColumns <SWfsProductComment>(new { CommentId = commentId, Status = 0 }));
     }
     else
     {//待审核状态:审核通过修改为审核通过并显示状态,如果不通过状态不变(待审核)
         if (verify == 1)
         {
             return(DapperUtil.UpdatePartialColumns <SWfsProductComment>(new { CommentId = commentId, Status = 1 }));
         }
     }
     UpdateSWfsProductCommentOperateUserId(commentId, PresentationHelper.GetPassport().UserName);
     //return DapperUtil.UpdatePartialColumns<SWfsProductComment>(new { CommentId = commentId, Status = status });
     return(false);
 }
示例#17
0
        public ActionResult AddNewGoodsListByNewComming()
        {
            //要追加的商品编号
            string goodsidlist = Request.Form["GoodsNo"].ToString();
            //要追加的商品所属的上新编号
            string newcommingid = Request.Form["NewCommingId"].ToString();

            string[] arr  = goodsidlist.Split(',');
            int      sort = 30;
            int      num  = 0;

            for (int i = 0; i < arr.Length - 1; i++)
            {
                var arr1 = arr[i].Split('-');

                int count = sWfsIndexNewArrivalProductListService.AddSWfsIndexNewArrivalProductListGoods(arr1[0], newcommingid);
                if (count <= 0)
                {
                    SWfsIndexNewArrivalProductList sWfsIndexNewArrivalProductList = new SWfsIndexNewArrivalProductList();
                    sWfsIndexNewArrivalProductList.ProductNo    = arr1[0];
                    sWfsIndexNewArrivalProductList.NewArrivalId = int.Parse(newcommingid);
                    sWfsIndexNewArrivalProductList.SortValue    = sort--;
                    //获取当前用户
                    Passport passport = PresentationHelper.GetPassport();
                    sWfsIndexNewArrivalProductList.OperateUserId = passport.UserName;

                    num += sWfsIndexNewArrivalProductListService.AddSWfsIndexNewArrivalProductList(sWfsIndexNewArrivalProductList);
                }
            }

            if (num > 0)
            {
                EnyimMemcachedClient.Instance.Remove("ComBeziWfs_NewArrivalProductInfo_GetNewArrivalProductInfoByStartDate_getNewArrivalInfo");
                return(Content("添加成功!"));
            }
            else
            {
                return(Content("添加失败!"));
            }
        }
示例#18
0
        public ActionResult TopicRefDeleById(string SubjectNo, string ActivityId, int Status)
        {
            int    count = 0;
            string mess  = string.Empty;

            if (Status > 0)
            {
                //是否已经关联,如果关联不执行添加方法,直接count=1成功
                SWfsVActivityTopicsRef obj = Vcode.SelectSingleBySubjectNoRef(SubjectNo, ActivityId);
                if (obj == null)
                {
                    obj = new SWfsVActivityTopicsRef();

                    obj.ActivityId = ActivityId;
                    obj.OperatorId = PresentationHelper.GetPassport().UserName;
                    obj.DateCreate = DateTime.Now;
                    obj.TopicNo    = SubjectNo;
                    count          = Vcode.TopicsRefCreate(obj);
                }
                else
                {
                    count = 1;
                }
                mess = "关联成功";
            }
            else
            {
                count = Vcode.TopicRefDelete(SubjectNo, ActivityId); mess = "取消关联";
            }

            if (count > 0)
            {
                return(Json(new { result = "1", message = mess }));
            }
            else
            {
                return(Json(new { result = "0", message = "修改失败!" }));
            }
        }
示例#19
0
        public ActionResult SignIn(string flag = "", string msg = "")
        {
            Passport model = PresentationHelper.GetPassport();

            if (model.IsAuthenticate())
            {
                //return Redirect("/Login/Phoneverification");
                return(Redirect("/Shangpin/Brand/AIIBrandsSelect"));
            }
            ViewBag.Flag     = flag;
            ViewBag.Msg      = msg;
            ViewBag.Checked  = "0";
            ViewBag.UserName = string.Empty;
            string userName = PresentationHelper.GetCookie("RemberOCSUser");

            if (!string.IsNullOrEmpty(userName))
            {
                ViewBag.Checked  = "1";
                ViewBag.UserName = userName;
            }
            return(View());
        }
示例#20
0
        protected static void SetUpHelpers(Controller controller)
        {
            FormHelper htmlHelper = new FormHelper();

            htmlHelper.SetController(controller);

            ValidationHelper validationHelper = new ValidationHelper();

            validationHelper.SetController(controller);

            PresentationHelper presentationHelper = new PresentationHelper();

            presentationHelper.SetController(controller);

            PaginationHelper paginationHelper = new PaginationHelper();

            paginationHelper.SetController(controller);

            controller.PropertyBag["HtmlHelper"]         = htmlHelper;
            controller.PropertyBag["ValidationHelper"]   = validationHelper;
            controller.PropertyBag["PresentationHelper"] = presentationHelper;
            controller.PropertyBag["PaginationHelper"]   = paginationHelper;
        }
示例#21
0
        /// <summary>
        /// 保存添加活动图
        /// </summary>
        /// <returns></returns>
        public ActionResult ActivityPicCreateSave()
        {
            SWfsStyleActivityPic model = new SWfsStyleActivityPic();

            string ActivityName = Request.Params["ActivityName"] ?? "";
            string PicUrl       = Request.Params["PicUrl"] ?? "";
            string StartTime    = Request.Params["StartTime"] ?? "";

            #region   图片
            string imgerror  = string.Empty;
            string congigPic = "width:180,Height:350,Length:200";
            string picNo     = ImgNameGet("PicNo", congigPic, true, out imgerror);
            if (!string.IsNullOrEmpty(imgerror))
            {
                return(Json(new { result = "-1", message = imgerror }, "text/plain", Encoding.UTF8));
            }
            #endregion

            model.ActivityName = ActivityName;
            model.PicNo        = picNo;
            model.PicUrl       = PicUrl;
            model.StartTime    = DateTime.Parse(StartTime);
            model.CreateDate   = DateTime.Now;
            model.CreateUserId = PresentationHelper.GetPassport().UserName;
            try
            {
                #region 插入活动图
                styleService.InsertStyleActivityPic(model);
                return(Json(new { result = "1", message = "添加成功!" }, "text/plain", Encoding.UTF8));

                #endregion
            }
            catch (Exception ex)
            {
                return(Json(new { result = "0", message = ex.Message }));
            }
        }
示例#22
0
        //修改上新时间
        public ActionResult UpdateNewDateManage(string brandNo, string configValue, string configName, string configTime, string memcache_key)
        {
            SwfsFlagShipGloalConfig config = new SwfsFlagShipGloalConfig();

            config.BrandNo     = brandNo;
            config.ConfigValue = configValue.TrimEnd(',');
            config.ConfigName  = configName;
            config.ConfigTime  = configTime;
            Passport passport = PresentationHelper.GetPassport();//用户

            config.OperateUserId = passport.UserName;
            SwfsFlagShipNewArrivalProductService service = new SwfsFlagShipNewArrivalProductService();
            int count = service.ConfigNewDate(config);

            if (count == 0)
            {
                return(Json(new { message = "修改失败" }));
            }
            else
            {
                EnyimMemcachedClient.Instance.Remove(memcache_key);
                return(Json(new { message = "修改成功" }));
            }
        }
示例#23
0
 public int DeleteSWfsQuestAnswerRefById(string Id, string questAnswerId)
 {
     UpdateSWfsQuestAnswerOperateUserId(Convert.ToInt32(questAnswerId), PresentationHelper.GetPassport().UserName);
     return(DapperUtil.Execute("ComBeziWfs_SWfsProductQuestAnswerRef_DeleteSWfsProductQuestAnswerRef_DeleteById", new { Id = Id }));
 }
示例#24
0
 //修改咨询前台显示状态
 public bool UpdateSWfsQuestAnswerIsShow(int questAnswerId, int isShow)
 {
     UpdateSWfsQuestAnswerOperateUserId(questAnswerId, PresentationHelper.GetPassport().UserName);
     return(DapperUtil.UpdatePartialColumns <SWfsQuestAnswer>(new { QuestAnswerId = questAnswerId, IsShow = isShow }));
 }
示例#25
0
 //更新一条新的咨询
 public bool UpdateSWfsQuestAnswer(SWfsQuestAnswer QA)
 {
     UpdateSWfsQuestAnswerOperateUserId(QA.QuestAnswerId, PresentationHelper.GetPassport().UserName);
     return(DapperUtil.Update <SWfsQuestAnswer>(QA));
 }
示例#26
0
 //插入一条新的咨询
 public int InsertSWfsQuestAnswer(SWfsQuestAnswer QA)
 {
     UpdateSWfsQuestAnswerOperateUserId(QA.QuestAnswerId, PresentationHelper.GetPassport().UserName);
     return(DapperUtil.Insert <SWfsQuestAnswer>(QA, false));
 }
示例#27
0
 public bool UpdateCommentRContentById(string commentId, string commentRContent, string reType)
 {
     //return DapperUtil.Execute("ComBeziWfs_SWfsProductComment_UpdateCommentRContent", new { CommentId = commentId, CommentRContent = commentRContent});
     if (reType == "result")
     {
         return(DapperUtil.UpdatePartialColumns <SWfsProductComment>(new { CommentId = commentId, ResultCode = commentRContent, ResultDate = DateTime.Now, ResultNo = PresentationHelper.GetPassport().UserName }));
     }
     else
     {
         return(DapperUtil.UpdatePartialColumns <SWfsProductComment>(new { CommentId = commentId, CommentRContent = commentRContent, CommentRDate = DateTime.Now, OperateUserId = PresentationHelper.GetPassport().UserName }));
     }
 }
示例#28
0
        public string VCodeCreate()
        {
            SWfsVActivity obj        = null;
            bool          isupdate   = false;//用isupdat来区分添加和修改操作
            string        activityId = Request.Form["ActivityId"];

            if (!string.IsNullOrEmpty(activityId))
            {
                isupdate = true;
                obj      = DapperUtil.QueryByIdentityWithNoLock <SWfsVActivity>(activityId);
            }
            else
            {
                obj            = new SWfsVActivity();
                obj.DateCreate = DateTime.Now;
            }

            //添加操作需要赋值的部分
            if (isupdate == false)
            {
                string activityNo = DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.Millisecond.ToString();
                obj.ActivityId = activityNo;
            }



            //修改添加都需要赋值的【公共部分】
            obj.ActivityTypeId = 7;
            obj.ActivityName   = Request.Form["ActivityName"];
            //如保存过v码则不允许编辑对于disabled数据后台获取不到 需判断值
            if (!string.IsNullOrEmpty(Request.Form["ActivityCode"]))
            {
                obj.ActivityCode = Request.Form["ActivityCode"];
            }
            obj.ActivityStatus = Request.Form["ActivityStatus"] != null?Convert.ToInt16(Request.Form["ActivityStatus"]) : (short)1;

            obj.ActivityDateStart = DateTime.Parse(Request.Form["ActivityDateStart"]);
            obj.ActivityDateEnd   = DateTime.Parse(Request.Form["ActivityDateEnd"]);
            obj.OperatorId        = PresentationHelper.GetPassport().UserName;
            obj.ListingOutletFlag = short.Parse(Request.Form["siteNo"]);

            //根据isupdat谁的操作去做谁的事
            if (isupdate == false)
            {
                if (Vcode.VCodeCreate(obj) >= 0)
                {
                    return("{\"result\":\"success\"}");
                }
                else
                {
                    return("{\"result\":\"false\"}");
                }
            }
            else
            {
                if (Vcode.VCodeUpdate(obj))
                {
                    return("{\"result\":\"success\"}");
                }
                else
                {
                    return("{\"result\":\"false\"}");
                }
            }
        }
示例#29
0
        public ActionResult Manager(SWfsSubjectTimeGroup form)
        {
            form.GroupName = form.GroupName.Trim();
            if (string.IsNullOrWhiteSpace(form.GroupName))
            {
                return(Json(new { reslut = "error", msg = "请填写分组名称" }));
            }
            if (form.GroupName.Trim().Length > 10)
            {
                return(Json(new { reslut = "error", msg = "分组名称不能超过10个汉字" }));
            }
            if (form.DateBegin == null)
            {
                return(Json(new { reslut = "error", msg = "分组开始时间不能为空" }));
            }
            if (form.DateEnd == null)
            {
                return(Json(new { reslut = "error", msg = "分组结束时间不能为空" }));
            }
            SubjectTimeGroupService service = new SubjectTimeGroupService();//验证数据
            var file = Request.Files["picFileNo"];

            Dictionary <string, string> rsPic;

            if (form.GID <= 0)//写入
            {
                if (file == null || file.ContentLength <= 0)
                {
                    return(Json(new { reslut = "error", msg = "请上传分组图片" }));
                }
                SWfsSubjectTimeGroup originNameModel = service.SelectByName(form.GroupName);//查询是否存在相同的分组名称
                if (originNameModel != null && originNameModel.GroupName == form.GroupName)
                {
                    return(Json(new { reslut = "error", msg = string.Format("分组名称{0}已经存在", form.GroupName) }));
                }
                SWfsSubjectTimeGroup originTimeModel = service.SelectByTime(form.DateBegin, form.DateEnd, form.GID);//查询是否存在相同的分组名称
                if (originTimeModel != null)
                {
                    return(Json(new { reslut = "error", msg = string.Format("当前时间段有重复分组{0}—{1}", originTimeModel.DateBegin.ToShortTimeString(), originTimeModel.DateEnd.ToShortTimeString()) }));
                }
                form.CreateUserId = PresentationHelper.GetPassport().UserName;
                form.DateCreate   = DateTime.Now;
                form.DateUpdate   = DateTime.Now;
                form.UpdateUserId = PresentationHelper.GetPassport().UserName;
                form.Status       = 1;
                form.GroupPicLink = "";
                form.GroupPicType = 0;
                form.ShowType     = 2;
                rsPic             = fileNo(file);
                if (!rsPic.Keys.Contains("success"))
                {
                    return(Json(new { reslut = "error", msg = "请上传符合要求的图片" }));
                }
                form.GroupPicNo = rsPic["success"];
                try
                {
                    service.Add(form);
                }
                catch (Exception e)
                {
                    return(Json(new { reslut = "error", msg = e.Message }));
                }
            }
            else //修改
            {
                SWfsSubjectTimeGroup model = service.GetModelById(form.GID);
                model.GroupName = form.GroupName;
                if (file != null && file.ContentLength > 0)
                {
                    rsPic = fileNo(file);
                    if (!rsPic.Keys.Contains("success"))
                    {
                        return(Json(new { reslut = "error", msg = "请上传符合要求的图片" }));
                    }
                    model.GroupPicNo = rsPic["success"];
                }
                SWfsSubjectTimeGroup originNameModel = service.SelectByName(form.GroupName);//查询是否存在相同的分组名称
                if (originNameModel != null && originNameModel.GroupName == form.GroupName && originNameModel.GID != form.GID)
                {
                    return(Json(new { reslut = "error", msg = string.Format("分组名称{0}已经存在", form.GroupName) }));
                }
                SWfsSubjectTimeGroup originTimeModel = service.SelectByTime(form.DateBegin, form.DateEnd, form.GID);//查询是否存在相同的分组名称
                if (originTimeModel != null)
                {
                    return(Json(new { reslut = "error", msg = string.Format("当前时间段有重复分组{0}—{1}", originTimeModel.DateBegin.ToShortTimeString(), originTimeModel.DateEnd.ToShortTimeString()) }));
                }
                try
                {
                    model.DateBegin = form.DateBegin;
                    model.DateEnd   = form.DateEnd;
                    service.Update(model);
                }
                catch (Exception e)
                {
                    return(Json(new { reslut = "error", msg = e.Message }));
                }
            }
            return(Json(new { reslut = "success", msg = "操作成功" }));
        }
示例#30
0
        public ActionResult Manager()
        {
            string                      topicNo       = Request.Form["TopicNo"];
            CommonService               commonService = new CommonService();
            SWfsTopicService            topicService  = new SWfsTopicService();
            Dictionary <string, string> rsPic         = new Dictionary <string, string>();
            SWfsTopics                  model         = new SWfsTopics();

            //加上修改的逻辑前的读取
            if (!string.IsNullOrEmpty(topicNo))
            {
                model = topicService.GetSWfsTopics(topicNo);
                if (null == model)
                {
                    return(Json(new { reslut = "error", msg = "专题不存在" }));
                }
            }
            model.DateBegin  = Convert.ToDateTime(string.IsNullOrEmpty(Request.Form["DateBegin"]) ? "1900-1-1" : Request.Form["DateBegin"]);
            model.DateCreate = DateTime.Now;
            model.DateEnd    = Convert.ToDateTime(string.IsNullOrEmpty(Request.Form["DateEnd"]) ? "1900-1-1" : Request.Form["DateEnd"]);
            if (string.IsNullOrEmpty(topicNo)) //添加时写入这些字段
            {
                model.DateTop       = new DateTime(1900, 1, 1);
                model.IsTop         = false;
                model.Status        = 0;//默认刚添加的专题为关闭状态
                model.CreaterUserId = PresentationHelper.GetPassport().UserName;
            }
            model.DepartmentName = "";
            model.DepartmentNo   = "";
            model.Gender         = Convert.ToInt16(Request.Form["ChannelNos"]);
            model.PushDescripton = Request.Form["PushDescripton"];

            model.SubHeading      = Request.Form["SubHeading"];
            model.TopicName       = Request.Form["TopicName"];
            model.TopicTotalPicNo = "";
            model.TopicURL        = "";
            model.Types           = 0;
            model.WebSite         = 2;


            if (null != Request.Files["TopicPicFile"] && Request.Files["TopicPicFile"].ContentLength > 0)
            {
                rsPic = commonService.PostImg(Request.Files["TopicPicFile"], "width:1680,Height:390,Length:500");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = "error", msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.TopicPic = rsPic["success"];
                }
            }
            if (null != Request.Files["WapPicFileNo"] && Request.Files["WapPicFileNo"].ContentLength > 0)
            {
                rsPic = commonService.PostImg(Request.Files["WapPicFileNo"], "width:640,Height:320,Length:150");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = "error", msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.WapPicFileNo = rsPic["success"];
                }
            }
            if (null != Request.Files["IPhonePicFileNo"] && Request.Files["IPhonePicFileNo"].ContentLength > 0)
            {
                rsPic = commonService.PostImg(Request.Files["IPhonePicFileNo"], "width:640,Height:0,Length:150");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = "error", msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.IPhonePicNo = rsPic["success"];
                }
            }

            model.ThumbnailFileNo   = "";
            model.FillPictureFileNo = "";
            if (null != Request.Files["ThumbnailFileNo"] && Request.Files["ThumbnailFileNo"].ContentLength > 0)
            {
                rsPic = commonService.PostImg(Request.Files["ThumbnailFileNo"], "width:78,Height:63,Length:5");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = "error", msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.ThumbnailFileNo = rsPic["success"];
                }
            }
            if (null != Request.Files["FillPictureFileNo"] && Request.Files["FillPictureFileNo"].ContentLength > 0)
            {
                rsPic = commonService.PostImg(Request.Files["FillPictureFileNo"], "width:6,Height:390,Length:10");
                if (rsPic.Keys.Contains("error"))
                {
                    return(Json(new { reslut = "error", msg = rsPic["error"] }));
                }
                if (rsPic.Keys.Contains("success"))
                {
                    model.FillPictureFileNo = rsPic["success"];
                }
            }

            ///放到最后处理
            if (string.IsNullOrEmpty(topicNo))//新增
            {
                topicNo = DateTime.Now.ToString("yyyyMMdd");
                string topicId = new CommonService().GetNextCounterId("TopicNo").ToString("000");
                topicNo      += topicId.Substring(topicId.Length - 3, 3);
                model.TopicNo = topicNo;
                try
                {
                    topicService.AddSWfsTopics(model);
                    return(Json(new { reslut = "success", msg = "添加成功" }));
                }
                catch (Exception e)
                {
                    return(Json(new { reslut = "error", msg = e.Message }));
                }
            }
            else //修改
            {
                model.TopicNo = topicNo;
                bool rs = topicService.UpateSWfsTopics(model);
                return(Json(new { reslut = rs ? "success" : "error", msg = rs ? "修改成功" : "修改失败" }));
            }
        }