Example #1
0
        /// <summary>
        /// 保存行业
        /// </summary>
        public JsonResult SaveIndustry(string industry)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Industry             model      = serializer.Deserialize <Industry>(industry);

            bool flag = false;

            if (string.IsNullOrEmpty(model.IndustryID))
            {
                model.CreateUserID = string.Empty;
                flag = !string.IsNullOrEmpty(IndustryBusiness.InsertIndustry(model.Name, model.Description, CurrentUser.UserID, string.Empty)) ? true : false;
            }
            else
            {
                model.CreateUserID = string.Empty;
                flag = IndustryBusiness.UpdateIndustry(model.IndustryID, model.Name, model.Description);
            }
            JsonDictionary.Add("result", flag ? 1 : 0);

            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #2
0
        /// <summary>
        /// 添加行业
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public JsonResult CreateIndustry(string name)
        {
            string id = IndustryBusiness.InsertIndustry(name, "", string.Empty, ClientID);

            JsonDictionary.Add("ID", id);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }