Ejemplo n.º 1
0
        public void bind()
        {
            tbCreatedDate.Text = DateTime.Today.ToLongDateString();
            ExtendBLL.Dictionary eDictionary = new ExtendBLL.Dictionary();
            List<Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>();
            listCClass = eDictionary.GetItemListByDClass("haocaileibie");
            ddlCClass.DataSource = listCClass;
            ddlCClass.DataTextField = "Name";
            ddlCClass.DataValueField = "Code";
            ddlCClass.DataBind();

            listCClass = eDictionary.GetItemListByDClass("shebeilaiyuan");
            ddlSource.DataSource = listCClass;
            ddlSource.DataTextField = "Name";
            ddlSource.DataValueField = "Code";
            ddlSource.DataBind();

            listCClass = eDictionary.GetItemListByDClass("shiyongfangxiang");
            ddlArrow.DataSource = listCClass;
            ddlArrow.DataTextField = "Name";
            ddlArrow.DataValueField = "Code";
            ddlArrow.DataBind();

            listCClass = eDictionary.GetItemListByDClass("jingfeikemu");
            ddlFundsSubject.DataSource = listCClass;
            ddlFundsSubject.DataTextField = "Name";
            ddlFundsSubject.DataValueField = "Code";
            ddlFundsSubject.DataBind();

            listCClass = eDictionary.GetItemListByDClass("dangwei");
            ddlModle.DataSource = listCClass;
            ddlModle.DataTextField = "Name";
            ddlModle.DataValueField = "Code";
            ddlModle.DataBind();

            //LabMS.BLL.Lab blab = new LabMS.BLL.Lab();
            //List<LabMS.Model.Lab> mLab = new List<LabMS.Model.Lab>();
            //mLab = blab.GetModelList(" Lab_ParentID is null ");
            //ddlAddress.DataSource = mLab;
            //ddlAddress.DataTextField = "Lab_Name";
            //ddlAddress.DataValueField = "Lab_Code";
            //ddlAddress.DataBind();

            ExtendBLL.InstrumentAndConsumables eConsum = new ExtendBLL.InstrumentAndConsumables();
            int iMaxCID = eConsum.GetMaxId();
            MaxCID.Value = iMaxCID.ToString("D10");
            tbInstrumentNum.Text = iMaxCID.ToString("D10");
        }
Ejemplo n.º 2
0
 ExtendModule.InstrumentAndConsumables checkQueryString(string strID)
 {
     ExtendBLL.InstrumentAndConsumables bconsum = new ExtendBLL.InstrumentAndConsumables();
     string strWhere = " Type = 'xiaohaopin' and ID =" + strID;
     List<ExtendModule.InstrumentAndConsumables> listinstrument = bconsum.GetExtendModelList(strWhere);
     if (listinstrument.Count <= 0)
     {
         return null;
     }
     return listinstrument[0];
 }
Ejemplo n.º 3
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            #region 验证
            if (string.IsNullOrEmpty(tbCNub.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "耗材编号不能为空!");
                return;
            }
            ExtendBLL.InstrumentAndConsumables extendconsum
                = new ExtendBLL.InstrumentAndConsumables();
            bool bLegal =  extendconsum.isNumbersLegal(tbCNub.Text.Trim(), "xiaohaopin");
            if (!bLegal)
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "耗材编号已存在!");
                return;
            }
            if (string.IsNullOrEmpty(tbCName.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "耗材名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(tbTypeNub.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "型号不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(tbNub.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "数量不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(tbPrice.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "单价不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(tbBuyDate.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "购置日期不能为空!");
                return;
            }

            #endregion

            lbErr.Visible = false;
            Model.InstrumentAndConsumables consumables = new LabMS.Model.InstrumentAndConsumables();
            BLL.InstrumentAndConsumables bconsumables = new LabMS.BLL.InstrumentAndConsumables();
            consumables.Arrow = ddlArrow.SelectedValue;
            consumables.ClassNumber = ddlCClass.SelectedValue;
            consumables.Name = tbClassNub.Text.Trim();
            consumables.CountryCode = tbCountry.Text;
            consumables.CreatedDate = DateTime.Today;
            consumables.Documents = tbDocuments.Text.Trim();
            consumables.FactoryCode = tbFNub.Text.Trim();
            consumables.FundsSubject = ddlFundsSubject.SelectedValue;
            consumables.Measurement = ddlModle.SelectedValue;
            consumables.Model = tbTypeNub.Text.Trim();
            consumables.Name = tbCName.Text.Trim();
            consumables.Numbers = tbCNub.Text.Trim();
            consumables.OperatorDate = DateTime.Now;
            DateTime tempTime = new DateTime();
            if (DateTime.TryParse(tbProduceDate.Text.Trim(), out tempTime))
            {
                consumables.ProductionDate = tempTime;
            }
            if (DateTime.TryParse(tbBuyDate.Text.Trim(), out tempTime))
            {
                consumables.PurchaseDate = tempTime;
            }
            decimal iTemp = 0;
            if (decimal.TryParse(tbNub.Text.Trim(), out iTemp))
            {
                consumables.Quantity = iTemp;
            }
            consumables.Source = ddlComeFrom.SelectedValue;
            consumables.SpaceLocation = tbLocationCode.Text;
            consumables.StockLocation = tbLocationCode.Text; ;
            consumables.Type = "xiaohaopin";
            consumables.UnitPrice = tbPrice.Text.Trim();
            consumables.Purpose = tbPurpose.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);

                    consumables.Pic = PhotoArray;//相片
                    consumables.PicType = PhotoContentType;//图片类型
                }
            }
            catch
            {
                LabMS.Common.JShelper.JSAlert(Page, "Picwrong", "程序错误:图片保存出错");
            }
            //无供应商
            try
            {
                bconsumables.Add(consumables);
                LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "添加成功!", "addconsum.aspx");
            }
            catch (Exception ex)
            {
                lbErr.Visible = true;
                lbErr.Text = ex.Message.ToString();
            }
        }
Ejemplo n.º 4
0
 ExtendModule.InstrumentAndConsumables checkQueryString(string strID)
 {
     ExtendBLL.InstrumentAndConsumables bvaluables = new ExtendBLL.InstrumentAndConsumables();
     string strWhere = " Type = 'guizhongyiqi' and ID =" + strID;
     List<ExtendModule.InstrumentAndConsumables> listvaluables = bvaluables.GetExtendModelList(strWhere);
     if (listvaluables.Count <= 0)
     {
         return null;
     }
     return listvaluables[0];
 }