protected void Submit(string status) { Model.GoodsMaintain goods = new LabMS.Model.GoodsMaintain(); BLL.GoodsMaintain bgoods = new LabMS.BLL.GoodsMaintain(); goods.LabName = tbLabNum.Text.Trim(); goods.AssetManagers = tbManager.Text.Trim(); goods.Tel = tbTelNum.Text.Trim(); goods.Numbers = tbLowNum.Text.Trim(); goods.Name = tbLowname.Text.Trim(); goods.StorageSites = tbStoreAdd.Text.Trim(); goods.Applicant = tbApplyer.Text.Trim(); goods.Guarantee = isInTime.SelectedValue; DateTime tempTime = new DateTime(); if (DateTime.TryParse(tbReportTime.Text.Trim(), out tempTime)) { goods.ReportedTime = tempTime; } goods.Describe = tbDescription.Text.Trim(); goods.Status = status; try { bgoods.Add(goods); LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "操作成功!", "valuablesdamagereport.aspx"); } catch (Exception ex) { Err.Text = ex.Message.ToString(); } }
protected void savedata(string status) { if (tbInstrumentName.Text.Trim() == "") { LabMS.Common.JShelper.JSAlert(Page, "err", "仪器不可以为空!"); return; } if (tbApplyer.Text.Trim() == "") { LabMS.Common.JShelper.JSAlert(Page, "err", "申请人不可以为空!"); return; } BLL.GoodsMaintain binstrument = new LabMS.BLL.GoodsMaintain(); Model.GoodsMaintain instrment = new LabMS.Model.GoodsMaintain(); instrment.Numbers = tbInstrumentNum.Text; instrment.Name = tbInstrumentName.Text; instrment.AssetManagers = tbManager.Text.Trim(); instrment.Tel = tbTelNum.Text; instrment.StorageSites = tbLocation.Text; //ddlStockLocation.SelectedValue; instrment.LabName = ddlLab.SelectedValue; instrment.Guarantee = isInTime.SelectedValue; instrment.Applicant = tbApplyer.Text.Trim(); instrment.ReportedTime = DateTime.Parse( tbReportTime.Text); instrment.Describe = tbDescription.Text; instrment.Status = status.ToString().Trim(); BLL.InstrumentAndConsumables bins = new LabMS.BLL.InstrumentAndConsumables(); Model.InstrumentAndConsumables ins = (bins.GetModelList(" Numbers="+tbInstrumentNum.Text.Trim()))[0]; ins.PresentSituation = status; int i = Convert.ToInt32(ins.Quantity); i--; ins.Quantity = i; try { bins.Update(ins); } catch (Exception e) { LabMS.Common.JShelper.JSAlert(Page, "err", "添加失败1"); return; } try { binstrument.Add(instrment); } catch (Exception ee) { LabMS.Common.JShelper.JSAlert(Page, "err", "添加失败2"+ee.Message); return; } LabMS.Common.JShelper.JSAlertAndRedirect(Page, "err", "添加成功", "lowdamagereport.aspx"); }