Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request != null&&context.Request["Code"]!=null)
            {
                string strCode = context.Request["Code"].ToString();
                LabMS.BLL.InstrumentAndConsumables binstrument
                    = new LabMS.BLL.InstrumentAndConsumables();
                List<LabMS.Model.InstrumentAndConsumables> listInstrument
                    = new List<LabMS.Model.InstrumentAndConsumables>();
                ExtendBLL.Dictionary eDictionary = new ExtendBLL.Dictionary();
                List<Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>();

                listInstrument = binstrument.GetModelList("Numbers = '" + strCode+"'");
                if (listInstrument.Count < 0)
                {
                    return;
                }

                listCClass = eDictionary.GetModelList("Code='" + listInstrument[0].Status + "'");
                if (listCClass.Count < 0)
                {
                    return;
                }

                context.Response.ContentType = "application/json";
                context.Response.Write("{result: '" +listCClass[0].Name+ "'}");

            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            if (Request.QueryString["ID"] != null)
            {
                int EquipID = int.Parse(Request.QueryString["ID"]);
                LabMS.BLL.InstrumentAndConsumables equip = new LabMS.BLL.InstrumentAndConsumables();
                LabMS.Model.InstrumentAndConsumables equipinfo = new LabMS.Model.InstrumentAndConsumables();

                equipinfo = equip.GetModel(EquipID);
                byte[] PhotoArray = equipinfo.Pic;

                string PhotoType = equipinfo.PicType;
                if (PhotoArray != null)
                {
                    if (PhotoArray.Length != 0)
                    {
                        Response.ContentType = PhotoType;
                        Response.BinaryWrite(PhotoArray);
                        Response.End();
                    }
                }
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            CheckBox ch;
            LabMS.BLL.InstrumentAndConsumables bconsum = new LabMS.BLL.InstrumentAndConsumables();
            try
            {
                for (int i = 0; i < GridViewValuables.Rows.Count; i++)
                {
                    ch = (CheckBox)GridViewValuables.Rows[i].FindControl("checkdel");
                    if (ch.Checked)
                    {
                        string CID = GridViewValuables.DataKeys[i].Value.ToString();
                        bconsum.Delete(long.Parse(CID));
                    }
                }
                //checkall.Checked = false;
                if (tbKeyWords.Text.Trim().Equals("") && tbCreateDateMin.Text.Trim().Equals("") &&
                     tbCreateDateMax.Text.Trim().Equals("") && tbPurpose.Text.Trim().Equals(""))
                {
                    bind("");
                }
                else
                {
                    bind(SearchString());
                }

                Common.JShelper.JSAlert(Page, "success", "删除成功!");
            }
            catch (Exception ex)
            {
                Common.JShelper.JSAlert(Page, "err", "删除失败!");
                Err.Text = ex.Message;
            }
        }
Example #4
0
 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 btnDel_Click(object sender, EventArgs e)
 {
     LabMS.BLL.InstrumentAndConsumables bconsum = new LabMS.BLL.InstrumentAndConsumables();
     try
     {
         bconsum.Delete(long.Parse(lbCID.Text));
         LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "删除成功!", "InstrumentPreview.aspx");
     }
     catch (Exception ex)
     {
         lbErr.Visible = true;
         lbErr.Text = ex.Message.ToString();
     }
 }
        public void bind(string strCode, string strLocation, string strCondition)
        {
            LabMS.BLL.InstrumentAndConsumables bconsum = new LabMS.BLL.InstrumentAndConsumables();
            if (strCondition.Trim().Equals(""))
            {
                strCondition = "";
            }
            else
            {
                strCondition = " and " + strCondition;
            }
            string strWhere = " Type = '" + strCode + "'and SpaceLocation= '" + strLocation + "' and Quantity>0 " + strCondition + " order by ID desc ";
            if (strLocation.Equals("@ALL@"))
            {
                strWhere = " Type = '" + strCode + "'and  Quantity>0 " + strCondition + " order by ID desc ";
            }

            List<LabMS.Model.InstrumentAndConsumables> listmconsum = bconsum.GetModelList(strWhere);
            GridView1.DataSource = listmconsum;
            GridView1.DataBind();
        }
Example #7
0
        private void savedata(string status)
        {
            BLL.GoodsMaintain bgoodsmaintain = new LabMS.BLL.GoodsMaintain();
            Model.GoodsMaintain goodsmaintain = bgoodsmaintain.GetModel(Convert.ToInt32(strID.Text));
            goodsmaintain.MCo = tbRepairGroup.Text;
            goodsmaintain.MLinkman = tbTransfer.Text.Trim();
            goodsmaintain.MPhone = tbPhoneNum.Text;
            goodsmaintain.MComment = tbComments.Text;
            if (!tbRepairTime.Text.Trim().Equals(""))
            {
                goodsmaintain.MDate = DateTime.Parse(tbRepairTime.Text);
            }
            goodsmaintain.LabName = ddlLab.SelectedValue;
            goodsmaintain.AssetManagers = tbManager.Text;
            goodsmaintain.Tel = tbTelNum.Text;
            goodsmaintain.Guarantee = tbIsInTime.SelectedValue;
            goodsmaintain.Applicant = tbApplyer.Text.Trim();
            goodsmaintain.Describe = tbDescription.Text;
            goodsmaintain.Status = status;
            goodsmaintain.AcceptanceViews = tbAcceptanceViews.Text;

            BLL.InstrumentAndConsumables biac = new LabMS.BLL.InstrumentAndConsumables();
            Model.InstrumentAndConsumables iac;
            if (biac.GetModelList(" Numbers=" + tbinstrumentNum.Text.Trim()).Count != 0)
            {
                iac = biac.GetModelList(" Numbers=" + tbinstrumentNum.Text.Trim())[0];
                try
                {
                    bgoodsmaintain.Update(goodsmaintain);
                }
                catch (Exception e)
                {
                    Common.JShelper.JSAlert(Page, "Err", status + "失败");
                    return;
                }
                iac.Status = status;
                if (status == "正常")
                {
                    int i = Convert.ToInt32(iac.Quantity);
                    i++;
                    iac.Quantity = i;
                }
                biac.Update(iac);
                Common.JShelper.JSAlertAndRedirect(Page, "Err", status + "成功", "lowconformlist.aspx");
            }
            else
            {
                Common.JShelper.JSAlert(Page, "Err", status + "失败");
                return;
            }
        }
Example #8
0
        void bind(LabMS.Model.RecipientsApp recipientsApp)
        {
            Comment.Text = Common.codehelper.Decode(recipientsApp.AppComment);

            tbUserNub.Text = recipientsApp.AppNub;
            tbCNub.Text = recipientsApp.ClassNumber;
            List<LabMS.Model.InstrumentAndConsumables> mconsum = new List<LabMS.Model.InstrumentAndConsumables>();
            LabMS.BLL.InstrumentAndConsumables bconsum = new LabMS.BLL.InstrumentAndConsumables();

            mconsum = bconsum.GetModelList("Numbers='" + recipientsApp.ClassNumber + "'");
            if (mconsum.Count == 0)
            {
                Common.JShelper.JSAlert(Page, "err", "数据错误,请删除此条记录!");
                return;
            }
            try
            {
                lbAllNub.Text = mconsum[0].Quantity.Value.ToString();
            }
            catch
            {
            }
            LabMS.BLL.Lab blab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> mLab = new List<LabMS.Model.Lab>();
            mLab = blab.GetModelList("Lab_Code='" + recipientsApp.Laboratory + "'");
            if (mLab.Count > 0)
            {
                tbLabName.Text = mLab[0].Lab_Name;
            }
            tbLabCode.Value = recipientsApp.Laboratory;

            lbCName.Text = recipientsApp.Name;
            try
            {
                tbRecipientsDate.Text = recipientsApp.RecipientTime.Value.ToShortDateString();
            }
            catch { }

            lbTypeNub.Text = recipientsApp.Words;
        }
Example #9
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            lbErr.Visible = false;
            Model.InstrumentAndConsumables instrument = new LabMS.Model.InstrumentAndConsumables();
            BLL.InstrumentAndConsumables binstrument = new LabMS.BLL.InstrumentAndConsumables();
            instrument.ID = Convert.ToInt64(strID);
            instrument.Arrow = ddlArrow.SelectedValue;
            instrument.ClassNumber = ddlCClass.SelectedValue;
            instrument.ClassNumber = tbKindNum.Text.Trim();
            instrument.CountryCode = tbCountry.Text;
            instrument.CreatedDate = DateTime.Today;
            instrument.Documents = tbDocuments.Text.Trim();
            instrument.FactoryCode = tbFactoryCode.Text.Trim();
            instrument.FundsSubject = ddlFundsSubject.SelectedValue;
            instrument.Measurement = ddlModle.SelectedValue;
            instrument.Model = tbModel.Text.Trim();
            instrument.Name = tbInstrumentName.Text.Trim();
            instrument.Numbers = tbInstrumentNum.Text.Trim();
            instrument.OperatorDate = DateTime.Now;
            DateTime tempTime = new DateTime();
            if (DateTime.TryParse(tbProductionDate.Text.Trim(), out tempTime))
            {
                instrument.ProductionDate = tempTime;
            }
            if (DateTime.TryParse(tbPurchaseDate.Text.Trim(), out tempTime))
            {
                instrument.PurchaseDate = tempTime;
            }
            decimal iTemp = 0;
            if (decimal.TryParse(tbAmount.Text.Trim(), out iTemp))
            {
                instrument.Quantity = iTemp;
            }
            instrument.Source = ddlSource.SelectedValue;
            instrument.StockLocation = tbLocationCode.Text;
            instrument.PresentSituation = ddlPresentSituation.SelectedValue;
            instrument.Type = "lowvalue";
            instrument.ContactPhone = tbContactPhone.Text;
            instrument.ResponesoblePerson = tbResponesoblePerson.Text;
            instrument.UnitPrice = tbUnitPrice.Text.Trim();
            instrument.Purpose = tbPurpose.Text;
            instrument.Standards = tbStandards.Text;
            //修改图片
            try
            {
                if (imageUpload.HasFile)
                {
                    HttpPostedFile upPhoto = imageUpload.PostedFile;
                    int upPhotoLength = upPhoto.ContentLength;
                    string PhotoContentType = upPhoto.ContentType;
                    byte[] PhotoArray = new byte[upPhotoLength];
                    Stream PhotoStream = upPhoto.InputStream;
                    PhotoStream.Read(PhotoArray, 0, upPhotoLength);

                    instrument.Pic = PhotoArray;//相片
                    instrument.PicType = PhotoContentType;//图片类型
                }
            }
            catch
            {
                LabMS.Common.JShelper.JSAlert(Page, "Picwrong", "程序错误:图片保存出错");
            }
            //无供应商
            try
            {
                binstrument.Update(instrument);
                LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "修改成功!", "lowvalueedit.aspx?ID=" + strID);
            }
            catch (Exception ex)
            {
                lbErr.Visible = true;
                lbErr.Text = ex.Message.ToString();
            }
        }
Example #10
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            Model.InstrumentAndConsumables valuables = new LabMS.Model.InstrumentAndConsumables();
            BLL.InstrumentAndConsumables bvaluables = new LabMS.BLL.InstrumentAndConsumables();

            valuables.Numbers = tbInstrumentNum.Text.Trim();
            valuables.ClassNumber = tbKindNum.Text.Trim();
            valuables.Name = tbInstrumentName.Text.Trim();
            valuables.Standards = tbStandards.Text.Trim();
            valuables.Model = tbModel.Text.Trim();
            valuables.CountryCode = tbCountryCode.Text.Trim();
            valuables.StockLocation = tbLocationCode.Text;
            valuables.SpaceLocation = tbLocationCode.Text;
            valuables.Quantity = Convert.ToInt32(tbAmount.Text);
            valuables.UnitPrice = tbUnitPrice.Text.Trim();
            valuables.FactoryCode = tbFactoryCode.Text.Trim();
            valuables.Documents = tbDocuments.Text.Trim();
            valuables.Measurement = tbMeasurement.Text.Trim();
            valuables.Source = ddlSource.SelectedValue;

            DateTime tempTime = new DateTime();
            if (DateTime.TryParse(tbProductionDate.Text.Trim(), out tempTime))
            {
                valuables.ProductionDate = tempTime;
            }
            if (DateTime.TryParse(tbPurchaseDate.Text.Trim(), out tempTime))
            {
                valuables.PurchaseDate = tempTime;
            }
            if (DateTime.TryParse(tbOpeningTime.Text.Trim(), out tempTime))
            {
                valuables.OpeningTime = tempTime;
            }

            valuables.CreatedDate = Convert.ToDateTime(tbCreatedDate.Text);
            valuables.Arrow = ddlArrow.SelectedValue;
            valuables.PresentSituation = ddlPresentSituation.SelectedValue;
            valuables.FundsSubject = ddlFundsSubject.SelectedValue;
            valuables.ResponesoblePerson = tbResponesoblePerson.Text.Trim();
            valuables.ContactPhone = tbContactPhone.Text.Trim();
            valuables.Charges = tbCharges.Text.Trim();
            valuables.ZipCode = tbZipCode.Text.Trim();
            valuables.MailingAddress = tbMailingAddress.Text.Trim();
            valuables.Purpose = tbPurpose.Text.Trim();
            valuables.OperatorDate = DateTime.Now;
            valuables.Type = "guizhongyiqi";
            //上传图片
            try
            {
                if (imageUpload.HasFile)
                {
                    HttpPostedFile upPhoto = imageUpload.PostedFile;
                    int upPhotoLength = upPhoto.ContentLength;
                    string PhotoContentType = upPhoto.ContentType;
                    byte[] PhotoArray = new byte[upPhotoLength];
                    Stream PhotoStream = upPhoto.InputStream;
                    PhotoStream.Read(PhotoArray, 0, upPhotoLength);

                    valuables.Pic = PhotoArray;//相片
                    valuables.PicType = PhotoContentType;//图片类型
                }
            }
            catch
            {
                LabMS.Common.JShelper.JSAlert(Page, "Picwrong", "程序错误:图片保存出错");
            }
            try
            {
                bvaluables.Add(valuables);
                LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "添加成功!", "addvaluables.aspx");
            }
            catch (Exception ex)
            {
                Err.Text = ex.Message.ToString();
            }
        }
        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);
            }
        }
Example #12
0
 public void btDelete_Click(object sender, EventArgs e)
 {
     LabMS.BLL.InstrumentAndConsumables bconsum = new LabMS.BLL.InstrumentAndConsumables();
     try
     {
         bconsum.Delete(long.Parse(strID));
         LabMS.Common.JShelper.JSAlertAndRedirect(Page, "DeleteSuccess", "删除成功!", "valuablespreview.aspx");
     }
     catch (Exception ex)
     {
         lbErr.Visible = true;
         lbErr.Text = ex.Message.ToString();
     }
 }