protected void Save_Btn_Click(object sender, EventArgs e)
        {
            M_Design_Tlp tlpMod = new M_Design_Tlp();

            if (Mid > 0)
            {
                tlpMod = tlpBll.SelReturnModel(Mid);
            }
            tlpMod.TlpName = TlpName_T.Text;
            tlpMod.Price   = DataConvert.CDouble(Price_T.Text);
            tlpMod.Remind  = Remind_T.Text;
            tlpMod.ClassID = DataConvert.CLng(Node_Hid.Value);
            tlpMod.ZStatus = DataConvert.CLng(Request.Form["zstatus_rad"]);
            tlpMod.Score   = DataConvert.CDouble(Request.Form["score_num"]);
            if (!PreView_UP.FVPath.Equals(tlpMod.PreviewImg, StringComparison.CurrentCultureIgnoreCase))
            {
                if (PreView_UP.HasFile)
                {
                    tlpMod.PreviewImg = PreView_UP.SaveFile();
                }
                else
                {
                    tlpMod.PreviewImg = PreView_UP.FVPath;
                }
            }
            if (Mid > 0)
            {
                tlpBll.UpdateByID(tlpMod);
            }
            else
            {
                tlpBll.AddNewTlp(tlpMod);
            }
            function.WriteSuccessMsg("操作成功", "TlpList.aspx?type=" + ZType);
        }
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            M_Design_Tlp tlpMod = new M_Design_Tlp();

            if (Mid > 0)
            {
                tlpMod = tlpBll.SelReturnModel(Mid);
            }
            string oldimg = tlpMod.PreviewImg;

            tlpMod.TlpName = TlpName_T.Text;
            tlpMod.Price   = DataConvert.CDouble(Price_T.Text);
            tlpMod.Remind  = Remind_T.Text;
            tlpMod.ClassID = DataConvert.CLng(Node_Hid.Value);
            tlpMod.ZStatus = DataConvert.CLng(Request.Form["zstatus_rad"]);
            tlpMod.Score   = DataConvert.CDouble(Request.Form["score_num"]);
            tlpMod.ZType   = ZType;
            tlpMod.DefBy   = Request.Form["defby_chk"];
            if (!PreView_UP.FVPath.Equals(tlpMod.PreviewImg, StringComparison.CurrentCultureIgnoreCase))
            {
                if (PreView_UP.HasFile)
                {
                    tlpMod.PreviewImg = PreView_UP.SaveFile();
                }
                else
                {
                    tlpMod.PreviewImg = PreView_UP.FVPath;
                }
            }
            if (Mid > 0)
            {
                if (!tlpMod.PreviewImg.Equals(oldimg))
                {
                    M_Design_Page pageMod = pageBll.SelModelByTlp(tlpMod.ID);
                    pageMod.PreviewImg = tlpMod.PreviewImg;
                    pageBll.UpdateByID(pageMod);
                }
                tlpBll.UpdateByID(tlpMod);
            }
            else
            {
                tlpMod.ID = tlpBll.Insert(tlpMod);
                //添加一个新的场景
                M_Design_Page pageMod = new M_Design_Page();
                pageMod.TlpID      = tlpMod.ID;
                pageMod.ZType      = 1;
                pageMod.PreviewImg = tlpMod.PreviewImg;
                pageBll.Insert(pageMod);
            }
            function.WriteSuccessMsg("操作成功", "TlpList.aspx?type=" + ZType);
        }
 protected void RPT_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     int tlpID = Convert.ToInt32(e.CommandArgument);
     M_Design_Tlp tlpMod = tlpBll.SelReturnModel(tlpID);
     switch (e.CommandName)
     {
         case "del2":
             tlpMod.ZStatus = (int)ZLEnum.ConStatus.Recycle;
             tlpBll.UpdateByID(tlpMod);
             break;
         case "setdef":
             tlpBll.SetDef(tlpID, ZType);
             break;
         case "rec"://恢复
             tlpMod.ZStatus = 0;
             tlpBll.UpdateByID(tlpMod);
             break;
         case "del"://彻底删除
             tlpBll.Del(tlpMod.ID);
             break;
     }
     MyBind();
 }
示例#4
0
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            pageMod          = pageBll.SelModelByGuid(Mid);
            pageMod.Title    = Title_T.Text;
            pageMod.Meta     = Meta_T.Text;
            pageMod.Remind   = Remind_T.Text;
            err_sp.InnerHtml = "";
            if (Thumb_UP.HasFile)
            {
                Thumb_UP.SaveFile();
                pageMod.ThumbImg = Thumb_UP.FileUrl;
            }
            else //未指定文件,则以文本框中的为准
            {
                pageMod.ThumbImg = Thumb_UP.FVPath;
            }
            string oldimg = pageMod.PreviewImg;

            if (PreviewImg_UP.HasFile)
            {
                HttpPostedFile file  = PreviewImg_UP.Request.Files[0];
                var            image = System.Drawing.Image.FromStream(file.InputStream);
                PreviewImg_UP.SaveFile();
                pageMod.PreviewImg = PreviewImg_UP.FileUrl;
            }
            else
            {
                pageMod.PreviewImg = PreviewImg_UP.FVPath;
            }
            if (pageMod.TlpID > 0 && !pageMod.PreviewImg.Equals(oldimg))
            {
                B_Design_Tlp tlpBll = new B_Design_Tlp();
                M_Design_Tlp tlpMod = tlpBll.SelReturnModel(pageMod.TlpID);
                tlpMod.PreviewImg = pageMod.PreviewImg;
                tlpBll.UpdateByID(tlpMod);
            }
            pageBll.UpdateByID(pageMod);
            function.Script(this, "top.settitle('" + pageMod.Title + "');top.CloseDiag();");
        }