📄 pro_gift_add.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using YXShop.BLL;
using YXShop.Model;
using YXShop;
using YXShop.Common;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Product
{
public partial class Pro_Gift_Add : System.Web.UI.Page
{
public PageSet ps;
YXShop.BLL.Pro_Gift dataCA = new YXShop.BLL.Pro_Gift();
string type;
BasePage bp = new BasePage();
protected void Page_Load(object sender, EventArgs e)
{
type = Convert.ToString(Page.Request.QueryString["type"]);
if (!IsPostBack)
{
string ID = Convert.ToString(Page.Request.QueryString["YX_MID"]);
YXShop.Model.Pro_Gift data = new YXShop.Model.Pro_Gift();
if (type == "xg")
{
if (!PowerTree.PowerPass.isPass("002005004", PowerTree.PowerPanel.PowerType.update))
{
bp.PageError("对不起,你没有修改礼品项的权限!", "../index.aspx");
}
data.ProG_ID = Convert.ToInt32(ID);
txtname.Text = dataCA.GetId(Convert.ToInt32(ID))[0].ProG_Name.ToString();
txtrmb.Text = dataCA.GetId(Convert.ToInt32(ID))[0].ProG_Price.ToString();
txtjf.Text = dataCA.GetId(Convert.ToInt32(ID))[0].ProG_Ingegral.ToString();
txtsl.Text = dataCA.GetId(Convert.ToInt32(ID))[0].ProG_Number.ToString();
FCKeditor1.Value = dataCA.GetId(Convert.ToInt32(ID))[0].ProG_Descriptoin.ToString();
ViewState["tlj"] = dataCA.GetId(Convert.ToInt32(ID))[0].ProG_Images.ToString();
ViewState["Wid"] = ID;
}
else
{
if (!PowerTree.PowerPass.isPass("002005002", PowerTree.PowerPanel.PowerType.add))
{
bp.PageError("对不起,你没有添加礼品项的权限!", "../index.aspx");
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (txtrmb.Text == string.Empty)
{
txtrmb.Text = "0";
}
if (txtjf.Text == string.Empty)
{
txtrmb.Text = "0";
}
if (txtsl.Text == string.Empty)
{
txtrmb.Text = "0";
}
string b = YXShop.DBUtility.UploadFile.sjname();
string a = YXShop.DBUtility.UploadFile.ImagesMaxSize.ToString();
string c = "YXUploadFile/ProGift";
string d = "Gift";
string m = YXShop.DBUtility.UploadFile.UploadPicFile(FileUpload1, c, d).ToString();
YXShop.Model.Pro_Gift model = new YXShop.Model.Pro_Gift();
model.ProG_Name = txtname.Text.Trim();
model.ProG_Price = Convert.ToDecimal(txtrmb.Text.Trim());
model.ProG_Ingegral = Convert.ToDecimal(txtjf.Text.Trim());
model.ProG_Number = Convert.ToInt32(txtsl.Text.Trim());
model.ProG_Images = m;
model.ProG_Descriptoin = FCKeditor1.Value.ToString();
string aa = FileUpload1.FileName.ToString();
if (aa == "" && type == "xg")
{
model.ProG_Images = ViewState["tlj"].ToString();
}
if (type == "xg")
{
model.ProG_ID = Convert.ToInt32(ViewState["Wid"].ToString());
if (dataCA.Amend(model) > 0)
{
bp.PageRight("礼品修改成功。", "Pro_Gift_list.aspx");
}
}
else
{
if( dataCA.Create(model)> 0)
{
bp.PageRight("礼品添加成功。<li><a href='Pro_Gift_Add.aspx'>继续添加礼品</a></li>", "Pro_Gift_list.aspx");
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -