⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pro_intepurchaseadd.aspx.cs

📁 易想商城系统
💻 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.Data.OleDb;
using System.Collections.Generic;
using YXShop.BLL;
using YXShop.Model;
using Shop.Web.UI;


namespace YXShop.Web.Admin.Product
{
    public partial class Pro_IntePurchaseAdd : System.Web.UI.Page
    {
        YXShop.BLL.Pro_intePurchase dataCA = new YXShop.BLL.Pro_intePurchase();
        BasePage bp = new BasePage();
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Product.Pro_IntePurchaseAdd));
            this.Button1.Attributes["onclick"] = "return add2()";
            if (!IsPostBack)
            {     
                this.SelectProduct1.DsType = "3";
                if (Request["Pro_ID"] != null)
                {
                    if (!PowerTree.PowerPass.isPass("002001004", PowerTree.PowerPanel.PowerType.update))
                    {
                        bp.PageError("对不起,你没有修改团购项的权限!", "../index.aspx");
                    }
                    string cid = Page.Controls[0].Controls[3].Controls[3].ClientID;
                    List<YXShop.Model.Pro_intePurchase> data = dataCA.GetId(Convert.ToInt32(Request["Pro_ID"]));
                    this.txtbzj.Text = data[0].Pur_Deposit.ToString();
                    this.txtxgsl.Text = data[0].Pur_Count.ToString();
                    this.txtzsjf.Text = data[0].Pur_LargessIntegral.ToString();
                    this.txthdms.Text = data[0].Pur_ActDescription;
                    dpStart.Date = Convert.ToDateTime(data[0].Pur_ActStartTime.ToString());
                    dpEnd.Date = Convert.ToDateTime(data[0].Pur_ActEndTime.ToString());
                    SelectProduct1.PName = data[0].Pur_ProName;
                    SelectProduct1.PID = data[0].Pro_ID;
                    ViewState["pm"] = data[0].Pro_ID.ToString();
                    strmm = data[0].Pur_ladderCount;
                    strqq = data[0].Pur_ladderPrice;
                    string uu = data[0].Pur_ladderCount;
                    String[] ar = uu.Split(',');
                    strid = ar.Length;
                    txtsl.Text = ar[0].ToString();
                    string kk = data[0].Pur_ladderPrice;
                    String[] ab = kk.Split(',');
                    txtjg.Text = ab[0].ToString();
                    string mystr1 = "<script language='javascript'>StrAdd1();</script>";
                    if (!this.IsClientScriptBlockRegistered("buttonclick"))
                    {
                        this.RegisterStartupScript("buttonclick", mystr1);
                    }
                }
                else 
                {
                    if (!PowerTree.PowerPass.isPass("002001002", PowerTree.PowerPanel.PowerType.add))
                    {
                        bp.PageError("对不起,你没有添加团购项的权限!", "../index.aspx");
                    }
                }
            }

        }
        public string strqq;
        public string strmm;
        public int strid;
        protected void Button1_Click(object sender, EventArgs e)
        {if (SelectProduct1.PName == "")
                {
                    this.Label2.Text = " * 商品名称必选!";
                    return;
                }
            try
            {
                YXShop.Model.Pro_intePurchase data = new YXShop.Model.Pro_intePurchase();
                
                data.Pro_ID = 1;
                int a = Convert.ToInt32(Request.Params["Conut"]);
                string CountStr = "";
                string Countjg = "";
                if (a != 1)
                {
                    for (int i = 0; i < Convert.ToInt32(Request.Params["Conut"]); i++)
                    {
                        CountStr = txtsl.Text.Trim() + "," + Request.Params["txtwsl"].ToString();
                        Countjg = txtjg.Text.Trim() + "," + Request.Params["txtwjg"].ToString();
                    }
                }
                else
                {
                    CountStr = txtsl.Text.Trim();
                    Countjg = txtjg.Text.Trim();
                }

                data.Pur_ActStartTime = Convert.ToDateTime(dpStart.Date.ToString());
                data.Pur_ActEndTime = Convert.ToDateTime(dpEnd.Date.ToString());

                data.Pur_ladderCount = CountStr;
                data.Pur_ladderPrice = Countjg;
                data.Pur_ActDescription = txthdms.Text;
                if (txtbzj.Text == string.Empty)
                {
                    txtbzj.Text = "0";
                }
                if (txtzsjf.Text == string.Empty)
                {
                    txtzsjf.Text = "0";
                }
                if (txtxgsl.Text == string.Empty)
                {
                    txtxgsl.Text = "0";
                }
                data.Pur_Deposit = Convert.ToDecimal(txtbzj.Text.ToString());
                data.Pur_Count = Convert.ToInt32(txtxgsl.Text.ToString());
                data.Pur_LargessIntegral = Convert.ToDecimal(txtzsjf.Text.ToString());
                data.Pro_ID = Convert.ToInt32(SelectProduct1.PID.ToString());
                if (Request["Pro_ID"] != null)
                {
                    data.Pur_ID = Convert.ToInt32(Request["Pro_ID"]);
                    Response.Write(Request["Pro_ID"].ToString());
                    if(dataCA.Amend(data)> 0)
                    {
                        bp.PageRight("团购商品修改成功.", "Pro_IntePurchaseList.aspx");
                    }
                }
                else
                {
                    if(dataCA.Create(data)> 0)
                    {
                        bp.PageRight("团购商品添加成功.<li><a href='Pro_IntePurchaseAdd.aspx'>继续添加团购商品</a></li>", "Pro_IntePurchaseList.aspx");
                    }
                }
            }
            catch (Exception ex)
            {
                bp.PageError("添加或修改拍卖商品操作失败!", "Pro_IntePurchaseList.aspx");
            }
           
        }

        public void CreateCartTable()   //创建临时表
        {
            DataSet ds = new DataSet();
            DataTable newDT = new DataTable("CartTable");
            ds.Tables.Add(newDT);
            DataColumn newDC;
            newDC = new DataColumn("sl", System.Type.GetType("System.String"));
            ds.Tables["CartTable"].Columns.Add(newDC);
            newDC = new DataColumn("jg", System.Type.GetType("System.String"));
            ds.Tables["CartTable"].Columns.Add(newDC);
            newDC = new DataColumn("sj", System.Type.GetType("System.String"));
            ds.Tables["CartTable"].Columns.Add(newDC);
            Session["myCartTable"] = newDT;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -