private void TextBoxToModel(DataRow dr)
        {
            TPurchase       info        = _TPurchase;
            TPurchaseDetail tinfoDetail = new TPurchaseDetail();

            tinfoDetail.DetDetail = new MMS_PurchaseDetail();
            //TPurchaseDetail tinfoDetail = _TPurchase.Detail[0];
            string BillCode = dr["PurchaseBillCode"].ToString().Trim();
            int    BillId   = 0;

            if (BillId == 0)
            {
                info.Content.AuditFlag        = false;
                info.Content.InvoiceCode      = dr["InvoiceCode"].ToString().Trim();
                info.Content.Provider         = dr["Provider"].ToString().Trim();
                info.Content.PurchaseBillCode = dr["PurchaseBillCode"].ToString();
                if (!string.IsNullOrEmpty(dr["InvoiceDate"].ToString().Trim()))
                {
                    info.Content.InvoiceDate = Convert.ToDateTime(dr["InvoiceDate"].ToString().Trim());
                }

                if (!string.IsNullOrEmpty(dr["InvoiceCode"].ToString().Trim()))
                {
                    info.Content.InvoiceCode = dr["InvoiceCode"].ToString().Trim();
                }
                info.Content.PurchaseDate = DateTime.Now;
                info.Content.CheckMan     = RequestSession.GetSessionUser().UserAccount.ToString();
                info.Content.Operator     = Context.User.Identity.Name;
                info.Content.OperateDate  = DateTime.Now;
                info.OprType = OperateType.otInsert;
            }

            MMS_PurchaseDetail detail = tinfoDetail.DetDetail;

            detail.PurchaseBillCode = dr["PurchaseBillCode"].ToString(); //入库单号
            detail.ProductCode      = dr["ProductCode"].ToString();      //货品代码
            detail.Lot       = dr["Lot"].ToString();                     //批号
            detail.ValidDate = dr["ValidDate"].ToString();               //有效期
            if (!string.IsNullOrEmpty(dr["Quantity"].ToString()))        //数量
            {
                detail.Quantity = Convert.ToInt32(dr["Quantity"].ToString());
            }
            if (!string.IsNullOrEmpty(dr["Price"].ToString())) //单价
            {
                detail.Price = Convert.ToDouble(dr["Price"].ToString());
            }

            tinfoDetail.DetDetail = detail;
            tinfoDetail.OprType   = OperateType.otInsert;
            info.Detail.Add(tinfoDetail); //将操作实体添加到入库货品集合中

            int tempId = PurchaseService.Instance.SavePurchase(info);
        }
Пример #2
0
        public bool UpdateInfoDetail(MMS_PurchaseDetail info)
        {
            try
            {
                var query = from item in dc.MMS_PurchaseDetail
                            where item.ID == info.ID
                            select item;

                BatchEvaluate.Eval(info, query.First());
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(true);
        }
Пример #3
0
        private void ModelToDetailTextBox(TPurchaseDetail tinfo)
        {
            BindDict("Unit", ddlUnit); //将计量单位下拉框绑定字典
            //调用业务层方法取货品信息实体
            MMS_MaterialInfo   product = MaterialInfoService.Instance.GetProductInfoByCode(tinfo.DetDetail.ProductCode);
            MMS_PurchaseDetail detail  = tinfo.DetDetail;

            txtProductCode.Text = detail.ProductCode;                          //货品代码
            txtShortName.Text   = product.Material_Name;                       //货品简称
            txtSpecs.Text       = product.Material_Specification;              //规格
            txtLot.Text         = detail.Lot.ToString();                       //批号
            txtValidDate.Text   = detail.ValidDate.ToString();                 //有效期
            txtProvider.Text    = product.Material_Supplier.ToString();        //生产厂同
            ddlUnit.Text        = product.Material_Unit;                       //计量单位
            txtQuantity.Text    = detail.Quantity.ToString();                  //数量
            txtPrice.Text       = detail.Price.ToString();                     //单价
            txtSeldPrice.Text   = detail.SeldPrice.ToString();
            txtAmount.Text      = (detail.Quantity * detail.Price).ToString(); //金额=数量*单价
        }
Пример #4
0
        private void DetailTextBoxToModel(TPurchaseDetail tinfo)
        {
            MMS_PurchaseDetail detail = tinfo.DetDetail;

            detail.PurchaseBillCode = txtPurchaseBillCode.Text; //入库单号
            detail.ProductCode      = txtProductCode.Text;      //货品代码
            detail.Lot       = txtLot.Text.ToString();          //批号
            detail.ValidDate = txtValidDate.Text;               //有效期
            if (!string.IsNullOrEmpty(txtQuantity.Text))        //数量
            {
                detail.Quantity = Convert.ToInt32(txtQuantity.Text);
            }
            if (!string.IsNullOrEmpty(txtPrice.Text)) //单价
            {
                detail.Price = Convert.ToDouble(txtPrice.Text);
            }
            if (!string.IsNullOrEmpty(txtSeldPrice.Text)) //出货单价
            {
                detail.SeldPrice = Convert.ToDouble(txtSeldPrice.Text.ToString());
            }
        }
Пример #5
0
 public bool UpdateInfoDetail(MMS_PurchaseDetail info)
 {
     return(dao.UpdateInfoDetail(info));
 }