Ejemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase Edit()
        {
            fgMgr = new FgroupMgr(mySqlConnectionString);
            string json = string.Empty;

            try
            {
                if (!string.IsNullOrEmpty(Request.Form["rowid"]))
                {
                    fg.rowid = Convert.ToInt32(Request.Form["rowid"]);
                }

                if (!string.IsNullOrEmpty(Request.Form["groupName"]))
                {
                    fg.groupName = Request.Form["groupName"];
                }

                if (!string.IsNullOrEmpty(Request.Form["groupCode"]))
                {
                    fg.groupCode = Request.Form["groupCode"];
                }

                if (!string.IsNullOrEmpty(Request.Form["remark"]))
                {
                    fg.remark = Request.Form["remark"];
                }

                fg.kuser = "";
                int num = fgMgr.Save(fg);

                if (num == -1)
                {
                    json = "{success:true,msg:\"群組名稱 或 群組編號已存在。\"}";
                }
                else if (num == 2)
                {
                    json = "{success:true,msg:\"修改成功\"}";
                }
                else
                {
                    json = "{success:true,msg:\"修改失败\"}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,msg:\"修改失败\"}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }