protected void lbBorrow_Click(object sender, EventArgs e) { Model.Recipients mrecipients = new LabMS.Model.Recipients(); ExtendBLL.Recipients ebrecipients = new ExtendBLL.Recipients(); mrecipients.BorrowedState = TextBox6.Text.Trim(); mrecipients.ReturnState = TextBox7.Text.Trim(); mrecipients.Comment = TextBox8.Text.Trim(); DateTime tempTime = new DateTime(); if (DateTime.TryParse(TextBox10.Text.Trim(), out tempTime)) { mrecipients.EncodedTime = tempTime; } mrecipients.MRecipients = TextBox3.Text.Trim(); mrecipients.Name = TextBox2.Text.Trim(); mrecipients.Numbers = TextBox1.Text.Trim(); mrecipients.OperatDate = DateTime.Now; mrecipients.Operator = TextBox9.Text.Trim(); mrecipients.Type = "guizhongyiqi"; try { ebrecipients.ExtendAdd(mrecipients); LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "领用成功!", "valuablesborrow.aspx"); } catch (Exception ex) { Err.Text = ex.Message.ToString(); } }
protected void Submit_Click(object sender, EventArgs e) { LabMS.BLL.Recipients brecipients = new LabMS.BLL.Recipients(); LabMS.Model.Recipients mrecipients = new LabMS.Model.Recipients(); ExtendBLL.Recipients ebrecipients = new ExtendBLL.Recipients(); try { mrecipients = brecipients.GetModel(long.Parse(lbCID.Text)); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message.ToString(); } mrecipients.ReturnState = ddlRStatus.SelectedValue; mrecipients.ReturnTime = DateTime.Parse(tbReturnDate.Text.ToString()); try { ebrecipients.ExtendReturn(mrecipients); LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "归还成功!", "valuablesborrowlist.aspx"); } catch (Exception ex) { lbErr.Text = ex.Message.ToString(); } }
protected void lbReturn_Click(object sender, EventArgs e) { LabMS.BLL.Recipients brecipients = new LabMS.BLL.Recipients(); LabMS.Model.Recipients mrecipients = new LabMS.Model.Recipients(); ExtendBLL.Recipients ebrecipients = new ExtendBLL.Recipients(); try { mrecipients = brecipients.GetModel(long.Parse(lbCID.Text)); } catch (Exception ex) { Common.JShelper.JSAlert(Page, "err2", ex.Message.ToString()); return; } mrecipients.ReturnState = tbReturnState.Text; mrecipients.ReturnTime = DateTime.Parse(tbReturnTime.Text.ToString()); try { ebrecipients.ExtendReturn(mrecipients); LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "归还成功!", "lowrecipientslist.aspx"); } catch (Exception ex) { lbErr.Text = ex.Message.ToString(); } }
protected void Submit_Click(object sender, EventArgs e) { #region 验证 if (string.IsNullOrEmpty(tbCNub.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "仪器编号不能为空!"); return; } if (string.IsNullOrEmpty(tbRPersion.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "领用人不能为空!"); return; } if (string.IsNullOrEmpty(tbRecipientsDate.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "领用时间不能为空!"); return; } #endregion ExtendBLL.Recipients brecipients = new ExtendBLL.Recipients(); Model.Recipients recipients = new LabMS.Model.Recipients(); recipients.Comment = tbRemarks.Text; recipients.Name = lbCName.Text.Trim(); recipients.Numbers = tbCNub.Text.Trim(); recipients.Type = "lowvalue"; recipients.MRecipients = tbRPersion.Text.Trim(); try { DateTime temp = DateTime.Parse(tbRecipientsDate.Text.Trim()); recipients.EncodedTime = temp; } catch { } recipients.BorrowedState = tbBorrowstatus.Text.Trim(); recipients.Operator = tbOperator.Text.Trim(); try { DateTime temp = DateTime.Parse(tbRecipientsDate.Text.Trim()); recipients.OperatDate = temp; } catch { } try { brecipients.ExtendAdd(recipients); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message.ToString(); return; } LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "领用成功!", "lowrecipients.aspx"); }
protected void btnApp_Click(object sender, EventArgs e) { lbErr.Visible = false; Button btn = (Button)sender; string strAudit = ""; string strAlert = ""; if (btn.ID == "btnCancelApp") { strAudit = "0"; strAlert = "撤销申请成功!"; } if (btn.ID == "btnApp") { strAudit = "1"; strAlert = "申请成功,请等待审核!"; } if (btn.ID == "tbnCheck") { strAudit = "3"; strAlert = "审核成功!"; LabMS.BLL.RecipientsApp brapp = new LabMS.BLL.RecipientsApp(); LabMS.Model.RecipientsApp mrecipeintsapp = new LabMS.Model.RecipientsApp(); try { mrecipeintsapp = brapp.GetModel(long.Parse(tbID.Text)); } catch (Exception ex) { lbErr.Text = ex.Message; lbErr.Visible = true; return; } if (mrecipeintsapp == null) { Common.JShelper.JSAlert(Page, "err","数据错误,请删除此条记录!"); return; } List<LabMS.Model.InstrumentAndConsumables> mconsum = new List<LabMS.Model.InstrumentAndConsumables>(); LabMS.BLL.InstrumentAndConsumables bconsum = new LabMS.BLL.InstrumentAndConsumables(); mconsum = bconsum.GetModelList("Numbers='" + mrecipeintsapp.ClassNumber + "'"); if (mconsum.Count == 0) { Common.JShelper.JSAlert(Page, "err", "数据错误,请删除此条记录!"); return; } decimal iQuantityRecipients = 0; decimal.TryParse(mrecipeintsapp.AppNub, out iQuantityRecipients); if (iQuantityRecipients > mconsum[0].Quantity) { Common.JShelper.JSAlert(Page, "err", "库存不足!"); return; } else { if (mrecipeintsapp.Type == "xiaohaopin") { LabMS.Model.SuppliesRecipients model = new LabMS.Model.SuppliesRecipients(); model.Arrow = mrecipeintsapp.Arrow; model.Comment = "通过申请借出!"; model.EncodedTime = mrecipeintsapp.RecipientTime; model.EncodedWarehouse = mrecipeintsapp.EncodedWarehouse; model.Laboratory = mrecipeintsapp.Laboratory; model.Name = mrecipeintsapp.Name; model.Numbers = mrecipeintsapp.ClassNumber; model.OperatDate = DateTime.Today; model.Operator = "sys";//用户 model.QuantityRecipients = mrecipeintsapp.AppNub; model.Recipients = mrecipeintsapp.MRecipients; model.Words = mrecipeintsapp.Words; ExtendBLL.SuppliesRecipients EbSRecipient = new ExtendBLL.SuppliesRecipients(); try { EbSRecipient.ExtendAdd(model, (decimal)mconsum[0].Quantity); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message.ToString(); return; } } else { ExtendBLL.Recipients brecipients = new ExtendBLL.Recipients(); Model.Recipients recipients = new LabMS.Model.Recipients(); recipients.BorrowedState = "良好"; recipients.Comment = "通过申请借出!"; recipients.EncodedTime = mrecipeintsapp.RecipientTime; recipients.MRecipients = mrecipeintsapp.MRecipients; recipients.Name = mrecipeintsapp.Name; recipients.Numbers = mrecipeintsapp.ClassNumber; recipients.OperatDate = DateTime.Today; recipients.Operator = ""; recipients.Type = mrecipeintsapp.Type; try { brecipients.ExtendAdd(recipients); } catch (Exception ex) { lbErr.Visible = true; lbErr.Text = ex.Message.ToString(); return; } } } } if (btn.ID == "tbnUnChek") { strAudit = "2"; strAlert = "审核成功!"; } ExtendBLL.RecipientsApp extendrapp = new ExtendBLL.RecipientsApp(); string strID = tbID.Text; try { if (btn.ID == "btnApp" || btn.ID == "btnCancelApp") { extendrapp.UpdateStatus(strAudit, strID); } else { string strChecker = UserRealName;//用户名 string strCheckContent = VerifyComment.Text.Trim(); extendrapp.SetCheck(strAudit, strID, DateTime.Today.ToShortDateString(), strChecker, strCheckContent); } } catch (Exception ex) { lbErr.Text = ex.Message; lbErr.Visible = true; return; } if (tbEType.Text != "") { Common.JShelper.JSAlertAndRedirect(Page, "success", strAlert, "recipientappperview.aspx?ID=" + tbID.Text + "&Type=" + tbEType.Text); } else { Common.JShelper.JSAlertAndRedirect(Page, "success", strAlert, "recipientappperview.aspx?ID=" + tbID.Text); } }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public LabMS.Model.Recipients GetModel(long ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,Numbers,Name,Type,MRecipients,EncodedTime,ReturnTime,BorrowedState,ReturnState,Comment,Operator,OperatDate from Recipients "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.BigInt)}; parameters[0].Value = ID; LabMS.Model.Recipients model=new LabMS.Model.Recipients(); 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.Type=ds.Tables[0].Rows[0]["Type"].ToString(); model.MRecipients=ds.Tables[0].Rows[0]["MRecipients"].ToString(); if(ds.Tables[0].Rows[0]["EncodedTime"].ToString()!="") { model.EncodedTime=DateTime.Parse(ds.Tables[0].Rows[0]["EncodedTime"].ToString()); } if(ds.Tables[0].Rows[0]["ReturnTime"].ToString()!="") { model.ReturnTime=DateTime.Parse(ds.Tables[0].Rows[0]["ReturnTime"].ToString()); } model.BorrowedState=ds.Tables[0].Rows[0]["BorrowedState"].ToString(); model.ReturnState=ds.Tables[0].Rows[0]["ReturnState"].ToString(); model.Comment=ds.Tables[0].Rows[0]["Comment"].ToString(); model.Operator=ds.Tables[0].Rows[0]["Operator"].ToString(); if(ds.Tables[0].Rows[0]["OperatDate"].ToString()!="") { model.OperatDate=DateTime.Parse(ds.Tables[0].Rows[0]["OperatDate"].ToString()); } return model; } else { return null; } }