Beispiel #1
0
        private void bind()
        {
            Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product();
            int index = int.Parse(Request.QueryString["ProID"].ToString());

            Maticsoft.Model.Product     promodel  = probll.GetModel(index);
            Maticsoft.BLL.ProductType   typebll   = new Maticsoft.BLL.ProductType();
            Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString()));
            Maticsoft.BLL.ProductXing   xinbll    = new Maticsoft.BLL.ProductXing();
            Maticsoft.Model.ProductXing xinmodel  = xinbll.GetModel(int.Parse(promodel.ProXingID.ToString()));
            lblchutime.Text   = Convert.ToDateTime(promodel.Prochutime.ToString()).ToString("yyyy-MM-dd");
            lblstarttime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd");
            lbltitle.Text     = promodel.ProName;
            lbltype.Text      = typemodel.ProTypeTitle;
            lblxinghao.Text   = xinmodel.ProXingTitle;
            Image1.ImageUrl   = promodel.ImageURL;
            txtcontent.Text   = promodel.Procontent;
            if (promodel.Toujian == 1)
            {
                toujian.Visible = false;
            }
            else
            {
                toujian.Visible = true;
            }
        }
Beispiel #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtProTypeID.Text))
            {
                strErr += "ProTypeID格式错误!\\n";
            }
            if (this.txtProXingTitle.Text.Trim().Length == 0)
            {
                strErr += "ProXingTitle不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    ProXingID    = int.Parse(this.lblProXingID.Text);
            int    ProTypeID    = int.Parse(this.txtProTypeID.Text);
            string ProXingTitle = this.txtProXingTitle.Text;


            Maticsoft.Model.ProductXing model = new Maticsoft.Model.ProductXing();
            model.ProXingID    = ProXingID;
            model.ProTypeID    = ProTypeID;
            model.ProXingTitle = ProXingTitle;

            Maticsoft.BLL.ProductXing bll = new Maticsoft.BLL.ProductXing();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.ProductXing model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProductXing set ");
            strSql.Append("ProTypeID=@ProTypeID,");
            strSql.Append("ProXingTitle=@ProXingTitle");
            strSql.Append(" where ProXingID=@ProXingID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProXingID",    SqlDbType.Int,     4),
                new SqlParameter("@ProTypeID",    SqlDbType.Int,     4),
                new SqlParameter("@ProXingTitle", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.ProXingID;
            parameters[1].Value = model.ProTypeID;
            parameters[2].Value = model.ProXingTitle;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.ProductXing model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProductXing(");
            strSql.Append("ProTypeID,ProXingTitle)");
            strSql.Append(" values (");
            strSql.Append("@ProTypeID,@ProXingTitle)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProTypeID",    SqlDbType.Int,     4),
                new SqlParameter("@ProXingTitle", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.ProTypeID;
            parameters[1].Value = model.ProXingTitle;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.ProductXing GetModel(int ProXingID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ProXingID,ProTypeID,ProXingTitle from ProductXing ");
            strSql.Append(" where ProXingID=@ProXingID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProXingID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ProXingID;

            Maticsoft.Model.ProductXing model = new Maticsoft.Model.ProductXing();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ProXingID"].ToString() != "")
                {
                    model.ProXingID = int.Parse(ds.Tables[0].Rows[0]["ProXingID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ProTypeID"].ToString() != "")
                {
                    model.ProTypeID = int.Parse(ds.Tables[0].Rows[0]["ProTypeID"].ToString());
                }
                model.ProXingTitle = ds.Tables[0].Rows[0]["ProXingTitle"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
 private void ShowInfo(int ProXingID)
 {
     Maticsoft.BLL.ProductXing   bll   = new Maticsoft.BLL.ProductXing();
     Maticsoft.Model.ProductXing model = bll.GetModel(ProXingID);
     this.lblProXingID.Text    = model.ProXingID.ToString();
     this.lblProTypeID.Text    = model.ProTypeID.ToString();
     this.lblProXingTitle.Text = model.ProXingTitle;
 }
Beispiel #7
0
 protected void btnxing_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.ProductXing   xingbll   = new Maticsoft.BLL.ProductXing();
     Maticsoft.Model.ProductXing xingmodel = new Maticsoft.Model.ProductXing();
     xingmodel.ProTypeID = int.Parse(drpaddtypehao.SelectedValue.ToString());
     if (txtaddxinghao.Text.Trim() == "")
     {
         lblxinghao.Text = "请填写产品型号";
         return;
     }
     xingmodel.ProXingTitle = txtaddxinghao.Text.Trim();
     lblxinghao.Text        = "";
     xingbll.Add(xingmodel);
     txtaddxinghao.Text = string.Empty;
     lblxinghao.Text    = "产品型号提交成功";
 }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["ProID"] != null)
         {
             if (Request.QueryString["ProID"].ToString() != "")
             {
                 int proid = int.Parse(Request.QueryString["ProID"].ToString());
                 Maticsoft.BLL.Product       probll    = new Maticsoft.BLL.Product();
                 Maticsoft.Model.Product     promodel  = probll.GetModel(proid);
                 Maticsoft.BLL.ProductType   typebll   = new Maticsoft.BLL.ProductType();
                 Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString()));
                 Maticsoft.BLL.ProductXing   xingbll   = new Maticsoft.BLL.ProductXing();
                 Maticsoft.Model.ProductXing xingmodel = xingbll.GetModel(int.Parse(promodel.ProXingID.ToString()));
                 lblFatime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd");
                 int hitnum = 0;
                 if (promodel.HitNum != null)
                 {
                     promodel.HitNum = promodel.HitNum + 1;
                     probll.Update(promodel);
                     lblHitNum.Text = promodel.HitNum.ToString();
                 }
                 else
                 {
                     promodel.HitNum = 1;
                     probll.Update(promodel);
                     lblHitNum.Text = promodel.HitNum.ToString();
                 }
                 lblProcontent.Text   = promodel.Procontent;
                 lblProName.Text      = promodel.ProName;
                 lblProName1.Text     = promodel.ProName;
                 lblProTypeTitle.Text = typemodel.ProTypeTitle;
                 lblProXingTitle.Text = xingmodel.ProXingTitle;
                 ImgImageURL.ImageUrl = promodel.ImageURL;
             }
             else
             {
                 Response.Redirect("product.aspx");
             }
         }
         else
         {
             Response.Redirect("product.aspx");
         }
     }
 }
Beispiel #9
0
 protected void datapro_ItemDataBound(object sender, DataListItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         Maticsoft.BLL.Product pronll = new Maticsoft.BLL.Product();
         int proid = int.Parse(datapro.DataKeys[e.Item.ItemIndex].ToString());
         Maticsoft.Model.Product   promodel = pronll.GetModel(proid);
         Maticsoft.BLL.ProductType typebll  = new Maticsoft.BLL.ProductType();
         Maticsoft.BLL.ProductXing xingbll  = new Maticsoft.BLL.ProductXing();
         int typeid = int.Parse(promodel.ProTypeID.ToString());
         int xingid = int.Parse(promodel.ProXingID.ToString());
         Maticsoft.Model.ProductType typemodel = typebll.GetModel(typeid);
         Maticsoft.Model.ProductXing xingmodel = xingbll.GetModel(xingid);
         ((Label)e.Item.FindControl("lnlProXingID")).Text = xingmodel.ProXingTitle;
         ((Label)e.Item.FindControl("lblProTypeID")).Text = typemodel.ProTypeTitle;
     }
 }