public void Update(SolutionDemandModel model) { DbCommand Command = dbw.GetStoredProcCommand("UP_slDemand_Update"); dbw.AddInParameter(Command, "@demandid", DbType.Int32, model.DemandID); dbw.AddInParameter(Command, "@demanddetail", DbType.String, model.DemandDetail); dbw.AddInParameter(Command, "@fieldphotoes", DbType.String, model.FieldPhotoes); dbw.AddInParameter(Command, "@fieldsituation", DbType.String, model.FieldSituation); dbw.AddInParameter(Command, "@effectsituation", DbType.String, model.EffectSituation); dbw.AddInParameter(Command, "@budget", DbType.Decimal, model.Budget); dbw.AddInParameter(Command, "@contactor", DbType.String, model.Contactor); dbw.AddInParameter(Command, "@contactphone", DbType.String, model.ContactPhone); dbw.AddInParameter(Command, "@postcode", DbType.String, model.Postcode); dbw.AddInParameter(Command, "@region", DbType.String, model.Region); dbw.AddInParameter(Command, "@address", DbType.String, model.Address); dbw.AddInParameter(Command, "@userid", DbType.String, model.UserID); dbw.AddInParameter(Command, "@createtime", DbType.DateTime, model.CreateTime); dbw.AddInParameter(Command, "@updatetime", DbType.DateTime, model.UpdateTime); dbw.AddInParameter(Command, "@status", DbType.Int16, model.Status); dbw.ExecuteNonQuery(Command); }
public void Update(SolutionDemandModel model) { dal.Update(model); }
public void Add(SolutionDemandModel model) { dal.Add(model); }
private SolutionDemandModel GetModel(DataRow row) { SolutionDemandModel model = new SolutionDemandModel() { Address = Convert.ToString(row["Address"]), Budget = Convert.ToDecimal(row["Budget"]), Contactor = Convert.ToString(row["Contactor"]), ContactPhone = Convert.ToString(row["ContactPhone"]), CreateTime = Convert.ToDateTime(row["CreateTime"]), DemandDetail = Convert.ToString(row["DemandDetail"]), DemandID = Convert.ToInt32(row["DemandID"]), EffectSituation = Convert.ToString(row["EffectSituation"]), FieldPhotoes = Convert.ToString(row["FieldPhotoes"]), FieldSituation = Convert.ToString(row["FieldSituation"]), Postcode = Convert.ToString(row["Postcode"]), Region = Convert.ToString(row["Region"]), Status = Convert.ToInt16(row["Status"]), UpdateTime = Convert.ToDateTime(row["UpdateTime"]), UserID = Convert.ToString(row["UserID"]) }; return model; }
protected void Button_Add_Click(object sender, EventArgs e) { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(TextBox_DemandDetail.Text)) { ErrorMessage += "请填写需求信息\\n"; } if (Request.Files.Count <= 0 || Request.Files[0].ContentLength <= 0) { ErrorMessage += "场地图片不能为空\\n"; } if (String.IsNullOrEmpty(TextBox_Field.Text)) { ErrorMessage += "请填写场地信息\\n"; } if (String.IsNullOrEmpty(TextBox_Effect.Text)) { ErrorMessage += "请填写效果要求\n"; } if (String.IsNullOrEmpty(TextBox_Budget.Text)) { ErrorMessage += "请填写正确的预算金额\\n"; } if (String.IsNullOrEmpty(TextBox_Contactor.Text)) { ErrorMessage += "请填写联系人姓名\\n"; } if (String.IsNullOrEmpty(TextBox_Phone.Text)) { ErrorMessage += "请填写联系人电话\\n"; } if (String.IsNullOrEmpty(TextBox_PostCode.Text)) { ErrorMessage += "请填写邮政编码\\n"; } if (String.IsNullOrEmpty(TextBox_Address.Text)) { ErrorMessage += "请填写通信地址\\n"; } RegionInfo regionInfo = ucRegion.GetSelectedRegionInfo(); if (String.IsNullOrEmpty(regionInfo.Province) || String.IsNullOrEmpty(regionInfo.City)) { ErrorMessage += "所在地选择不完整\\n"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } SolutionDemandModel model = new SolutionDemandModel(); int DemandID = CommDataHelper.GetNewSerialNum(AppType.Solution); ArrayList FieldPhotoes = new ArrayList(); foreach (string s in Request.Files.AllKeys) { if (s.StartsWith("photo-field") && Request.Files[s].ContentLength > 0) { string ImageUrl, ImageShorUrl, UploadMessage; if (!CommonImageUpload.Upload(Request.Files[s], out ImageUrl, out ImageShorUrl, out UploadMessage)) { MessageBox.Show(this, UploadMessage); return; } else { FieldPhotoes.Add(ImageShorUrl); } } } var ImageUrls = String.Empty; foreach (string s in FieldPhotoes) { ImageUrls += s+","; } model.DemandID = DemandID; model.DemandDetail = TextBox_DemandDetail.Text; model.FieldPhotoes = ImageUrls.Substring(0, ImageUrls.Length - 1); model.FieldSituation = TextBox_Field.Text; model.EffectSituation = TextBox_Effect.Text; model.Budget = Convert.ToDecimal(TextBox_Budget.Text); model.Contactor = TextBox_Contactor.Text; model.ContactPhone = TextBox_Phone.Text; model.Postcode = TextBox_PostCode.Text; model.Region = String.Format("{0} {1} {2}", regionInfo.Province, regionInfo.City, regionInfo.County); model.Address = TextBox_Address.Text; model.UserID = GetUserID(); model.CreateTime = DateTime.Now; model.UpdateTime = DateTime.Now; model.Status = (int)SolutionDemandStatus.尚未处理; bll.Add(model); Response.Redirect("SubmitSucc.aspx?o=" + DemandID); }