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(tbUserNub.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "领用数量不能为空!");
                return;
            }
            string strTotalNub = lbAllNub.Text.Trim();
            decimal iTotalNub = 0;
            decimal.TryParse(strTotalNub, out iTotalNub);

            string strUseNub = tbUserNub.Text.Trim();
            decimal iUserNub = 0;
            decimal.TryParse(strUseNub, out iUserNub);

            if (iUserNub > iTotalNub)
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "库存不足!");
                return;
            }

            if (string.IsNullOrEmpty(tbLabName.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "领用实验室不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(tbRecipientsDate.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "领用时间不能为空!");
                return;
            }

            #endregion
            lbErr.Visible = false;
            Button btn = (Button)sender;
            string strbtnName = btn.ID;
            LabMS.BLL.RecipientsApp brecipientsApp = new LabMS.BLL.RecipientsApp();
            LabMS.Model.RecipientsApp recipientsApp = new LabMS.Model.RecipientsApp();
            recipientsApp.State = "0";
            if (strbtnName == "Submit")
            {
                recipientsApp.State = "1";
                recipientsApp.AppTime = DateTime.Now;
            }
            recipientsApp.AppComment = Common.codehelper.Encode(Comment.Text.Trim());
            recipientsApp.AppNub = tbUserNub.Text.Trim();
            recipientsApp.Arrow = ddlArrow.SelectedValue;
            recipientsApp.ClassNumber = tbCNub.Text;
            recipientsApp.EncodedWarehouse = ddlLabs.SelectedValue;
            recipientsApp.Laboratory = tbLabCode.Value;
            recipientsApp.MRecipients = UserRealName;
            recipientsApp.Name = lbCName.Text;
            recipientsApp.Numbers = "";//编号不需要
            DateTime temp = new DateTime();
            if (DateTime.TryParse(tbRecipientsDate.Text, out temp))
            {
                recipientsApp.RecipientTime = temp;
            }
            else
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "领用时间格式错误!");
                return;
            }
            recipientsApp.Type = ddlEType.SelectedValue;
            recipientsApp.Words = lbTypeNub.Text;
            try
            {
                brecipientsApp.Add(recipientsApp);
                LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "操作成功!", "recipientsapplication.aspx");
            }
            catch (Exception ex)
            {
                lbErr.Text = ex.Message;
                lbErr.Visible = true;
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 LabMS.Model.RecipientsApp checkQueryString(string strID)
 {
     LabMS.BLL.RecipientsApp bRecipientsApp = new LabMS.BLL.RecipientsApp();
     string strWhere = "ID =" + strID;
     List<LabMS.Model.RecipientsApp> listmRecipientsApp = bRecipientsApp.GetModelList(strWhere);
     if (listmRecipientsApp.Count == 0)
     {
         return null;
     }
     return listmRecipientsApp[0];
 }
Exemplo n.º 4
0
 protected void Del_Click(object sender, EventArgs e)
 {
     lbErr.Visible = false;
     LabMS.BLL.RecipientsApp brapp = new LabMS.BLL.RecipientsApp();
     string strID = tbID.Text;
     string strAlert = "删除成功!";
     try
     {
         brapp.Delete(long.Parse(strID));
     }
     catch (Exception ex)
     {
         lbErr.Text = ex.Message;
         lbErr.Visible = true;
         return;
     }
     if (tbEType.Text != "")
     {
         Common.JShelper.JSAlertAndRedirect(Page, "success", strAlert, "recipientsapplist.aspx?Type=" + tbEType.Text);
     }
     else
     {
         Common.JShelper.JSAlertAndRedirect(Page, "success", strAlert, "recipientsapplist.aspx");
     }
 }