private void Insert() { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(TextBox_Title.Text)) { ErrorMessage += "请输入标题!"; } if (String.IsNullOrEmpty(TextBox_Content.Text)) { ErrorMessage += "请输入内容!"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } ProductSpecificationModel model = new ProductSpecificationModel(); model.SpecificationID = CommDataHelper.GetNewSerialNum(AppType.Product); model.CategoryID = 0; model.CategoryPath = ""; model.Content = TextBox_Content.Text; model.CreateTime = DateTime.Now; model.Title = TextBox_Title.Text; model.Type = Convert.ToInt16(DropDown_Type.SelectedValue); bll.Insert(model); }
public void Insert(ProductSpecificationModel Model) { string SpName = "UP_pdProductSpecification_ADD"; DbCommand Command = dbw.GetStoredProcCommand(SpName); dbw.AddInParameter(Command, "@SpecificationID", DbType.Int32, Model.SpecificationID); dbw.AddInParameter(Command, "@Title", DbType.String, Model.Title); dbw.AddInParameter(Command, "@Content", DbType.String, Model.Content); dbw.AddInParameter(Command, "@CategoryID", DbType.Int32, Model.CategoryID); dbw.AddInParameter(Command, "@CategoryPath", DbType.String, Model.CategoryPath); dbw.AddInParameter(Command, "@CreateTime", DbType.DateTime, Model.CreateTime); dbw.AddInParameter(Command, "@Type", DbType.Int32, Model.Type); dbw.ExecuteNonQuery(Command); }
public ProductSpecificationModel GetModel(int SpecificationID) { string SpName = "UP_pdProductSpecification_GetModel"; DbCommand Command = dbr.GetStoredProcCommand(SpName); dbr.AddInParameter(Command, "@SpecificationID", DbType.Int32, SpecificationID); DataTable dt = dbr.ExecuteDataSet(Command).Tables[0]; ProductSpecificationModel model = null; if (dt.Rows.Count > 0) { model = new ProductSpecificationModel(dt.Rows[0]); } return model; }
public void Update(ProductSpecificationModel Model) { dal.Update(Model); }
public void Insert(ProductSpecificationModel Model) { dal.Insert(Model); }