コード例 #1
0
ファイル: BarController.cs プロジェクト: baixue001/IPS
        public IActionResult CateAdd_Submit(M_GuestBookCate model)
        {
            M_GuestBookCate cateMod = new M_GuestBookCate();

            if (CateID > 0)
            {
                cateMod = cateBll.SelReturnModel(Mid);
            }
            cateMod.CateName   = model.CateName;
            cateMod.NeedLog    = Convert.ToInt32(GetParam("NeedLog"));
            cateMod.PostAuth   = Convert.ToInt32(GetParam("PostAuth"));
            cateMod.ZipImgSize = model.ZipImgSize;
            cateMod.BarImage   = GetParam("BarImage_t");
            cateMod.GType      = 1;
            cateMod.ParentID   = DataConvert.CLng(GetParam("selected_Hid"));
            cateMod.BarOwner   = GetParam("BarOwner_Hid");
            cateMod.PermiBit   = DataConvert.CLng(GetParam("PermiBit")).ToString();
            cateMod.Desc       = model.Desc;
            //cateMod.IsPlat = DataConverter.CLng(IsPlat_T.Text);
            cateMod.SendScore     = model.SendScore;
            cateMod.ReplyScore    = model.ReplyScore;
            cateMod.Status        = model.Status;
            cateMod.IsShowUnaudit = model.IsShowUnaudit;
            GuestConfigInfo guestinfo = GuestConfig.GuestOption;
            GuestConfig     config    = new GuestConfig();

            if (CateID < 1)
            {
                cateMod.CateID = cateBll.Insert(cateMod);
                guestinfo.BarOption.Add(new BarOption()
                {
                    CateID   = cateMod.CateID,
                    UserTime = DataConvert.CLng(GetParam("UserTime_T")),
                    SendTime = DataConvert.CLng(GetParam("SendTime_T"))
                });
                config.Update(guestinfo);
                return(WriteOK("添加成功!", "CateList"));
            }
            else
            {
                cateBll.Update(cateMod);
                BarOption baroption = guestinfo.BarOption.Find(v => v.CateID == CateID);
                if (baroption == null)
                {
                    guestinfo.BarOption.Add(new BarOption()
                    {
                        CateID   = cateMod.CateID,
                        UserTime = DataConvert.CLng(GetParam("UserTime_T")),
                        SendTime = DataConvert.CLng(GetParam("SendTime_T"))
                    });
                }
                else
                {
                    baroption.UserTime = DataConvert.CLng(GetParam("UserTime_T"));
                    baroption.SendTime = DataConvert.CLng(GetParam("SendTime_T"));
                }
                config.Update(guestinfo);
                return(WriteOK("添加成功!", "CateList"));
            }
        }
コード例 #2
0
        public IActionResult CateAdd_Submit(M_GuestBookCate model)
        {
            M_GuestBookCate cateMod = cateBll.SelReturnModel(Mid);

            if (cateMod == null)
            {
                cateMod = new M_GuestBookCate();
            }
            cateMod.CateName      = model.CateName;
            cateMod.Status        = model.Status;
            cateMod.IsShowUnaudit = DataConvert.CLng(GetParam("IsShowUnaudit"));
            cateMod.Desc          = model.Desc;
            if (cateMod.CateID > 0)
            {
                cateBll.UpdateByID(cateMod);
            }
            else
            {
                cateBll.Insert(cateMod);
            }
            return(JavaScript("<script>parent.mybind();</script>"));
        }
コード例 #3
0
        protected void AddBar_Btn_Click(object sender, EventArgs e)
        {
            if (CateID > 0)
            {
                cateMod = cateBll.SelReturnModel(CateID);
            }
            cateMod.CateName      = txtCateName.Text;
            cateMod.NeedLog       = Convert.ToInt32(NeedLog.SelectedValue);
            cateMod.PostAuth      = Convert.ToInt32(PostAuth.SelectedValue);
            cateMod.ZipImgSize    = DataConverter.CLng(ZipImgSize_T.Text);
            cateMod.BarImage      = ImageInfo_T.Text;
            cateMod.GType         = Convert.ToInt32(GType_Rad.SelectedValue);
            cateMod.ParentID      = Convert.ToInt32(selected_Hid.Value);
            cateMod.BarOwner      = BarOwner_Hid.Value;
            cateMod.PermiBit      = PostType.SelectedValue;
            cateMod.Desc          = BarDesc_T.Text;
            cateMod.IsPlat        = DataConverter.CLng(IsPlat_T.Text);
            cateMod.SendScore     = Convert.ToInt32(SenderScore_T.Text);
            cateMod.ReplyScore    = Convert.ToInt32(ReplyScore_T.Text);
            cateMod.Status        = IsCheck_Ra.Checked ? 1 : 0;
            cateMod.IsShowUnaudit = CheckOpt_Ra.Checked ? 1 : 0;
            string returnurl = "";

            if (GType.Equals("0"))
            {
                returnurl = "GuestManage.aspx";
            }
            else
            {
                returnurl = "GuestCateMana.aspx?Type=1";
            }
            GuestConfigInfo guestinfo = GuestConfig.GuestOption;
            GuestConfig     config    = new GuestConfig();

            if (CateID <= 0)
            {
                int cateid = cateBll.Insert(cateMod);
                guestinfo.BarOption.Add(new BarOption()
                {
                    CateID = cateid, UserTime = Convert.ToInt32(UserTime_T.Text), SendTime = Convert.ToInt32(SendTime_T.Text)
                });
                config.Update(guestinfo);
                function.WriteSuccessMsg("添加成功!", returnurl);
            }
            else if (cateBll.Update(cateMod))
            {
                BarOption baroption = guestinfo.BarOption.Find(v => v.CateID == CateID);
                if (baroption == null)
                {
                    guestinfo.BarOption.Add(new BarOption()
                    {
                        CateID = CateID, UserTime = Convert.ToInt32(UserTime_T.Text), SendTime = Convert.ToInt32(SendTime_T.Text)
                    });
                }
                else
                {
                    baroption.UserTime = Convert.ToInt32(UserTime_T.Text);
                    baroption.SendTime = Convert.ToInt32(SendTime_T.Text);
                }
                config.Update(guestinfo);
                function.WriteSuccessMsg("修改成功!", returnurl);
            }
        }