protected void Button1_Click(object sender, EventArgs e) { HttpPostedFile file = fup_com_img.PostedFile; int imgId = UploadFile(file); if (imgId >= 0) { string number = txt_i_number.Text; string strageId = txt_i_strageID.Text; string name = txt_i_name.Text; string alertNumber = txt_i_alertNumber.Text; string comc = ddl_i_se.SelectedValue; string price = txt_i_price.Text; string valid = txt_i_valid.Text; Model.t_commodity commodity = new Model.t_commodity(); commodity.com_name = txt_i_name.Text; commodity.com_pic_ID = imgId; commodity.com_pri_ID = decimal.Parse(price); commodity.com_strageID = strageId; commodity.com_valid = valid; commodity.com_number = int.Parse(number); commodity.com_date = DateTime.Now; commodity.com_productDate = DateTime.Parse(txt_com_productDate.Text); commodity.com_conversionInt = int.Parse(price); commodity.com_comc_ID = int.Parse(comc); commodity.com_alertNumber = int.Parse(alertNumber); new BLL.t_commodity().Add(commodity); } }
protected void btn_Save_Click(object sender, EventArgs e) { Model.t_commodity commodity = new Model.t_commodity(); commodity.com_name = was_name.Text; commodity.com_number = Convert.ToInt32(was_number.Text); commodity.com_pri_ID = decimal.Parse(was_price.Text); commodity.com_productDate = this.Calendar1.SelectedDate; commodity.com_alertNumber = int.Parse(this.com_alertNumber.Text); commodity.com_strageID = this.com_strageID.Text; commodity.com_date = DateTime.Now; commodity.com_comc_ID = Convert.ToInt32(ddl_super.SelectedValue); commodity.com_conversionInt = int.Parse(this.was_price.Text); string _nid = (Request["cid"] == null) ? "1" : Request["cid"];; commodity.com_pic_ID = Convert.ToInt32(_nid); commodity.com_valid = was_valid.Text; new BLL.t_commodity().Add(commodity); Response.Redirect("CommodityView.aspx?menuid=23"); }