示例#1
0
        /// <summary>
        /// 编辑食谱
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit()
        {
            int        kid       = GetValueInt("kid");
            int        contentid = GetValueInt("contentid");
            RecipeInfo rec       = RecipeDataProxy.Recipe_GetModel(contentid);

            ViewData["kid"]        = kid;
            ViewData["contentid"]  = contentid;
            ViewData["recipeType"] = rec.Rec_types;
            return(View(rec));
        }
示例#2
0
        public ActionResult GetModel()
        {
            int        kid       = GetValueInt("kid");
            int        contentid = GetValueInt("contentid");
            recipeJson recJson   = new recipeJson();
            RecipeInfo rec       = RecipeDataProxy.Recipe_GetModel(contentid);

            recJson = rec.GetJson(true);

            ViewData["kid"]       = kid;
            ViewData["contentid"] = contentid;
            return(Json(recJson.week_contents, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        /// <summary>
        /// 新增/修改食谱
        /// </summary>
        /// <returns></returns>
        public JsonResult AddOrUpdate()
        {
            int type       = GetValueInt("type"); //0:新增,1:修改
            int kid        = GetValueInt("kid");
            int categoryid = (int)BaseDataProxy.ExecuteNonQuery(new Dictionary <string, string>()
            {
                { "@returnvalue", "0" },
                { "@categorycode", Request["categorycode"] ?? "mzsp" },
                { "@siteid", Request["kid"] }
            }, "kwebcms..cms_category_GetCategoryIDBySiteIDCategoryCode");
            int        contentid = GetValueInt("contentid");
            RecipeInfo rec       = new RecipeInfo();

            if (type == 0)//0:新增
            {
                //categoryid = GetValueInt("categoryid",categoryid);
                rec.siteid     = kid;
                rec.Categoryid = categoryid;
                rec.Contentid  = 0;
                rec.SendDate   = DateTime.Now;
                rec.Startdate  = DateTime.Now;
            }
            else
            {
                rec = RecipeDataProxy.Recipe_GetModel(contentid);
            }
            string recipeType = GetValue("recipeType");
            string Monday     = "";
            string Tuesday    = "";
            string Wednesday  = "";
            string Thursday   = "";
            string Friday     = "";
            string Saturday   = "";
            string Sunday     = "";

            string[] recipeArr = recipeType.Split(new string[] { "|#" }, StringSplitOptions.RemoveEmptyEntries);
            int      len       = recipeArr.Length;
            string   title     = GetValue("c00").Trim();
            string   fieldID   = "";

            for (int col = 1; col <= len; col++)   //column 餐点
            {
                for (int row = 1; row <= 7; row++) //row  星期
                {
                    fieldID = string.Format("c{0}{1}", row, col);
                    string str = GetValue(fieldID, "").Trim();
                    str = str.Replace("\r\n", ",").Replace(",,", ",");
                    switch (row)
                    {
                    case 1:
                        Monday += "|#" + str;
                        break;

                    case 2:
                        Tuesday += "|#" + str;
                        break;

                    case 3:
                        Wednesday += "|#" + str;
                        break;

                    case 4:
                        Thursday += "|#" + str;
                        break;

                    case 5:
                        Friday += "|#" + str;
                        break;

                    case 6:
                        Saturday += "|#" + str;
                        break;

                    case 7:
                        Sunday += "|#" + str;
                        break;

                    default:
                        break;
                    }
                }
            }
            rec.Title     = title;
            rec.Rec_types = recipeType;
            if (Monday.Length > 2)
            {
                rec.Monday = Monday.Substring(2);
            }
            if (Tuesday.Length > 2)
            {
                rec.Tuesday = Tuesday.Substring(2);
            }
            if (Wednesday.Length > 2)
            {
                rec.Wednesday = Wednesday.Substring(2);
            }
            if (Thursday.Length > 2)
            {
                rec.Thursday = Thursday.Substring(2);
            }
            if (Friday.Length > 2)
            {
                rec.Friday = Friday.Substring(2);
            }
            if (Saturday.Length > 2)
            {
                rec.Saturday = Saturday.Substring(2);
            }
            if (Sunday.Length > 2)
            {
                rec.Sunday = Sunday.Substring(2);
            }
            int identity = RecipeDataProxy.Recipe_AddOrUpdate(rec, UserID);

            return(this.Json(identity, JsonRequestBehavior.AllowGet));
        }