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"); }
protected void Submit(string status) { Model.GoodsMaintain mgoods = new LabMS.Model.GoodsMaintain(); BLL.GoodsMaintain bgoods = new LabMS.BLL.GoodsMaintain(); mgoods = bgoods.GetModel(long.Parse(strID)); mgoods.LabName = tbLabNum.Text.Trim(); mgoods.AssetManagers = tbManager.Text.Trim(); mgoods.Tel = tbTelNum.Text.Trim(); mgoods.Numbers = tbLowNum.Text.Trim(); mgoods.Name = tbLowname.Text.Trim(); mgoods.StorageSites = tbStoreAdd.Text.Trim(); mgoods.Applicant = tbApplyer.Text.Trim(); mgoods.Guarantee = isInTime.SelectedValue; DateTime tempTime = new DateTime(); if (DateTime.TryParse(tbReportTime.Text.Trim(), out tempTime)) { mgoods.ReportedTime = tempTime; } mgoods.Describe = tbDescription.Text.Trim(); mgoods.Status = status; mgoods.MCo = tbRepairGroup.Text.Trim(); mgoods.MLinkman = tbTransfer.Text.Trim(); mgoods.MPhone = tbPhoneNum.Text.Trim(); if (DateTime.TryParse(tbRepairTime.Text.Trim(), out tempTime)) { mgoods.MDate = tempTime; } mgoods.MComment = tbComments.Text.Trim(); mgoods.AcceptanceViews = tbConformComments.Text.Trim(); try { bgoods.Update(mgoods); LabMS.Common.JShelper.JSAlertAndRedirect(Page, "ModifySuccess", "操作成功!", "valuablesconformlist.aspx"); } catch (Exception ex) { Err.Text = ex.Message.ToString(); } }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public LabMS.Model.GoodsMaintain GetModel(long ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,Numbers,Name,LabName,AssetManagers,Tel,StorageSites,Guarantee,Applicant,Status,ReportedTime,Describe,Preson,MCo,MLinkman,MPhone,MDate,MComment,MPerson,AcceptanceViews,APerson,ATime from GoodsMaintain "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.BigInt)}; parameters[0].Value = ID; LabMS.Model.GoodsMaintain model=new LabMS.Model.GoodsMaintain(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { if(ds.Tables[0].Rows[0]["ID"].ToString()!="") { model.ID=long.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } model.Numbers=ds.Tables[0].Rows[0]["Numbers"].ToString(); model.Name=ds.Tables[0].Rows[0]["Name"].ToString(); model.LabName=ds.Tables[0].Rows[0]["LabName"].ToString(); model.AssetManagers=ds.Tables[0].Rows[0]["AssetManagers"].ToString(); model.Tel=ds.Tables[0].Rows[0]["Tel"].ToString(); model.StorageSites=ds.Tables[0].Rows[0]["StorageSites"].ToString(); model.Guarantee=ds.Tables[0].Rows[0]["Guarantee"].ToString(); model.Applicant=ds.Tables[0].Rows[0]["Applicant"].ToString(); model.Status=ds.Tables[0].Rows[0]["Status"].ToString(); if(ds.Tables[0].Rows[0]["ReportedTime"].ToString()!="") { model.ReportedTime=DateTime.Parse(ds.Tables[0].Rows[0]["ReportedTime"].ToString()); } model.Describe=ds.Tables[0].Rows[0]["Describe"].ToString(); model.Preson=ds.Tables[0].Rows[0]["Preson"].ToString(); model.MCo=ds.Tables[0].Rows[0]["MCo"].ToString(); model.MLinkman=ds.Tables[0].Rows[0]["MLinkman"].ToString(); model.MPhone=ds.Tables[0].Rows[0]["MPhone"].ToString(); if(ds.Tables[0].Rows[0]["MDate"].ToString()!="") { model.MDate=DateTime.Parse(ds.Tables[0].Rows[0]["MDate"].ToString()); } model.MComment=ds.Tables[0].Rows[0]["MComment"].ToString(); model.MPerson=ds.Tables[0].Rows[0]["MPerson"].ToString(); model.AcceptanceViews=ds.Tables[0].Rows[0]["AcceptanceViews"].ToString(); model.APerson=ds.Tables[0].Rows[0]["APerson"].ToString(); if(ds.Tables[0].Rows[0]["ATime"].ToString()!="") { model.ATime=DateTime.Parse(ds.Tables[0].Rows[0]["ATime"].ToString()); } return model; } else { return null; } }