示例#1
0
        public ActionResult ClubInfoAdd()
        {
            var model = new C_ClubInfo();
            var bll   = new C_ClubInfoBll();

            if (Request.QueryString["ClubInfoId"] != null)
            {
                model = bll.GetModel(int.Parse(Request.QueryString["ClubInfoId"].ToString()));
            }
            else
            {
                model.ClubDate = DateTime.Now;
                model.IsShow   = 1;
            }
            return(View(model));
        }
示例#2
0
        public Dictionary <string, object> Del()
        {
            C_ClubInfoBll bll    = new C_ClubInfoBll();
            var           idList = HttpContext.Current.Request.Form["idlist"].ToString();
            int           result = bll.UpdateAll(idList);

            if (result > 0)
            {
                return(new Dictionary <string, object>
                {
                    { "code", 1 },
                    { "result", result }
                });
            }
            else
            {
                return(new Dictionary <string, object>
                {
                    { "code", 0 }
                });
            }
        }
示例#3
0
        public Dictionary <string, object> Add(C_ClubInfo model)
        {
            C_ClubInfoBll bll = new C_ClubInfoBll();

            if (model.ClubInfoId > 0)
            {
                var oldmodel = bll.GetModel(model.ClubInfoId);
                model.CreateUserId   = oldmodel.CreateUserId;
                model.CreateUserName = oldmodel.CreateUserName;
                model.CreateTime     = oldmodel.CreateTime;
                if (bll.Update(model) > 0)
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", 1 }
                    });
                }
                else
                {
                    return(new Dictionary <string, object>
                    {
                        { "code", 0 }
                    });
                }
            }
            else
            {
                var modelnew = bll.GetModelByDate(model.ClubDate.ToString("yyyy-MM-dd"));
                if (modelnew.ClubInfoId == 0)
                {
                    model.CreateUserId   = ManageProvider.Provider.Current().UserId;
                    model.CreateUserName = ManageProvider.Provider.Current().Account;
                    model.CreateTime     = DateTime.Now;
                    if (bll.Add(model) > 0)
                    {
                        return(new Dictionary <string, object>
                        {
                            { "code", 1 }
                        });
                    }
                    else
                    {
                        return(new Dictionary <string, object>
                        {
                            { "code", 0 }
                        });
                    }
                }
                else
                {
                    model.ClubInfoId     = modelnew.ClubInfoId;
                    model.CreateUserId   = modelnew.CreateUserId;
                    model.CreateUserName = modelnew.CreateUserName;
                    model.CreateTime     = modelnew.CreateTime;
                    if (bll.Update(model) > 0)
                    {
                        return(new Dictionary <string, object>
                        {
                            { "code", 1 }
                        });
                    }
                    else
                    {
                        return(new Dictionary <string, object>
                        {
                            { "code", 0 }
                        });
                    }
                }
            }
        }