Inheritance: System.Web.UI.Page
Beispiel #1
0
        /// <summary>
        /// Deep load all BillOfMaterials children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.BillOfMaterialsProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.BillOfMaterialsProvider.DeepLoading += new EntityProviderBaseCore <BillOfMaterials, BillOfMaterialsKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.BillOfMaterialsProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("BillOfMaterials instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.BillOfMaterialsProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
Beispiel #2
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                BillOfMaterials mock   = CreateMockInstance(tm);
                bool            result = DataRepository.BillOfMaterialsProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                BillOfMaterialsQuery query = new BillOfMaterialsQuery();

                query.AppendEquals(BillOfMaterialsColumn.BillOfMaterialsId, mock.BillOfMaterialsId.ToString());
                if (mock.ProductAssemblyId != null)
                {
                    query.AppendEquals(BillOfMaterialsColumn.ProductAssemblyId, mock.ProductAssemblyId.ToString());
                }
                query.AppendEquals(BillOfMaterialsColumn.ComponentId, mock.ComponentId.ToString());
                query.AppendEquals(BillOfMaterialsColumn.StartDate, mock.StartDate.ToString());
                if (mock.EndDate != null)
                {
                    query.AppendEquals(BillOfMaterialsColumn.EndDate, mock.EndDate.ToString());
                }
                query.AppendEquals(BillOfMaterialsColumn.UnitMeasureCode, mock.UnitMeasureCode.ToString());
                query.AppendEquals(BillOfMaterialsColumn.BomLevel, mock.BomLevel.ToString());
                query.AppendEquals(BillOfMaterialsColumn.PerAssemblyQty, mock.PerAssemblyQty.ToString());
                query.AppendEquals(BillOfMaterialsColumn.ModifiedDate, mock.ModifiedDate.ToString());

                TList <BillOfMaterials> results = DataRepository.BillOfMaterialsProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
Beispiel #3
0
        ///<summary>
        ///  Returns a Typed BillOfMaterials Entity with mock values.
        ///</summary>
        static public BillOfMaterials CreateMockInstance_Generated(TransactionManager tm)
        {
            BillOfMaterials mock = new BillOfMaterials();

            mock.StartDate      = TestUtility.Instance.RandomDateTime();
            mock.EndDate        = TestUtility.Instance.RandomDateTime();
            mock.BomLevel       = TestUtility.Instance.RandomShort();
            mock.PerAssemblyQty = (decimal)TestUtility.Instance.RandomShort();
            mock.ModifiedDate   = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Product mockProductByComponentId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByComponentId);
            mock.ComponentId = mockProductByComponentId.ProductId;
            //OneToOneRelationship
            Product mockProductByProductAssemblyId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByProductAssemblyId);
            mock.ProductAssemblyId = mockProductByProductAssemblyId.ProductId;
            //OneToOneRelationship
            UnitMeasure mockUnitMeasureByUnitMeasureCode = UnitMeasureTest.CreateMockInstance(tm);

            DataRepository.UnitMeasureProvider.Insert(tm, mockUnitMeasureByUnitMeasureCode);
            mock.UnitMeasureCode = mockUnitMeasureByUnitMeasureCode.UnitMeasureCode;

            // create a temporary collection and add the item to it
            TList <BillOfMaterials> tempMockCollection = new TList <BillOfMaterials>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((BillOfMaterials)mock);
        }
Beispiel #4
0
        public EntityObjectBase LoadObj(string strType)
        {
            string           strBillNo = this.Request["BillNo"].ToString();
            string           strDeptID = this.Request["DeptID"].ToString();
            EntityObjectBase eob       = null;

            switch (strType)
            {
            case "BOM":
                BillOfMaterials bom = new BillOfMaterials();
                bom.cnvcBillNo = strBillNo;
                bom.cnvcDeptID = strDeptID;
                eob            = ReportQueryFacade.CommonQuery(bom);
                break;

            case "BOV":
                BillOfValidate bov = new BillOfValidate();
                bov.cnvcBillNo = strBillNo;
                bov.cnvcDeptID = strDeptID;
                eob            = ReportQueryFacade.CommonQuery(bov);
                break;

            case "BOS":
                BillOfOutStorage bos = new BillOfOutStorage();
                bos.cnvcBillNo = strBillNo;
                bos.cnvcDeptID = strDeptID;
                eob            = ReportQueryFacade.CommonQuery(bos);
                break;
            }
            return(eob);
        }
Beispiel #5
0
        ///<summary>
        ///  Update the Typed BillOfMaterials Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance_Generated(TransactionManager tm, BillOfMaterials mock)
        {
            mock.StartDate      = TestUtility.Instance.RandomDateTime();
            mock.EndDate        = TestUtility.Instance.RandomDateTime();
            mock.BomLevel       = TestUtility.Instance.RandomShort();
            mock.PerAssemblyQty = (decimal)TestUtility.Instance.RandomShort();
            mock.ModifiedDate   = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Product mockProductByComponentId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByComponentId);
            mock.ComponentId = mockProductByComponentId.ProductId;

            //OneToOneRelationship
            Product mockProductByProductAssemblyId = ProductTest.CreateMockInstance(tm);

            DataRepository.ProductProvider.Insert(tm, mockProductByProductAssemblyId);
            mock.ProductAssemblyId = mockProductByProductAssemblyId.ProductId;

            //OneToOneRelationship
            UnitMeasure mockUnitMeasureByUnitMeasureCode = UnitMeasureTest.CreateMockInstance(tm);

            DataRepository.UnitMeasureProvider.Insert(tm, mockUnitMeasureByUnitMeasureCode);
            mock.UnitMeasureCode = mockUnitMeasureByUnitMeasureCode.UnitMeasureCode;
        }
        public async Task <IActionResult> Edit(int id, [Bind("BillOfMaterialsId,ProductAssemblyId,ComponentId,StartDate,EndDate,UnitMeasureCode,Bomlevel,PerAssemblyQty,ModifiedDate")] BillOfMaterials billOfMaterials)
        {
            if (id != billOfMaterials.BillOfMaterialsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(billOfMaterials);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BillOfMaterialsExists(billOfMaterials.BillOfMaterialsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ComponentId"]       = new SelectList(_context.Product, "ProductId", "Name", billOfMaterials.ComponentId);
            ViewData["ProductAssemblyId"] = new SelectList(_context.Product, "ProductId", "Name", billOfMaterials.ProductAssemblyId);
            ViewData["UnitMeasureCode"]   = new SelectList(_context.UnitMeasure, "UnitMeasureCode", "UnitMeasureCode", billOfMaterials.UnitMeasureCode);
            return(View(billOfMaterials));
        }
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (!this.BOMValidate())
                {
                    return;
                }
                BillOfMaterials bom = GetBOM();

                Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;

                BusiLog busiLog = new BusiLog();
                busiLog.cnvcOperName = curOper.cnvcOperName;
                busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                busiLog.cnvcDeptName = curDept.cnvcDeptName;


                ReportQueryFacade.UpdateBOM(bom, busiLog);
                this.Popup("专供油领料单修改成功");
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
        }
        private BillOfMaterials GetBOM()
        {
            Oper            curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
            BillOfMaterials _bom    = new BillOfMaterials();

            _bom.SetOriginalValue();
            _bom.cnvcBillNo          = txtBillNo.Text.Trim();
            _bom.cnvcContractNo      = ddlContractNo.SelectedValue;
            _bom.cnvcDeliveryCompany = ddlDeliveryCompany.SelectedValue;
            _bom.cnvcProvideCompany  = txtProvideCompany.Text.Trim();
            _bom.cnvcGoodsName       = ddlGoodsName.SelectedItem.Text;
            _bom.cnvcGoodsType       = ddlGoodsType.SelectedValue;
            _bom.cnvcUnit            = "KG";
            _bom.cnnReceiveCount     = Convert.ToDecimal(txtReceiveCount.Text.Trim());
            _bom.cnnCount            = Convert.ToDecimal(txtCount.Text.Trim());
            _bom.cnvcDeliveryMan     = txtDeliveryMan.Text.Trim();
            _bom.cndDeliveryDate     = Convert.ToDateTime(txtDeliveryDate.Text);
            _bom.cndProvideBeginDate = Convert.ToDateTime(txtProvideBeginDate.Text);
            _bom.cndProvideEndDate   = Convert.ToDateTime(txtProvideEndDate.Text);
            _bom.cndProvideMan       = txtProvideMan.Text.Trim();
            _bom.cnvcSignerCompany   = txtSignerCompany.Text.Trim();
            _bom.cnvcSigner          = txtSigner.Text.Trim();
            _bom.cndTimeOfValidity   = Convert.ToDateTime(txtProvideEndDate.Text);
            _bom.cnvcOperName        = curOper.cnvcOperName;
            _bom.cnnSpecialUnitPrice = Convert.ToDecimal(txtSpecialUnitPrice.Text.Trim());
            _bom.cnnSpecialFee       = Convert.ToDecimal(txtSpecialFee.Text.Trim());
            _bom.cnvcDeptID          = this.txtDeptID.Text;  //SysInitial.LocalDeptID;
            return(_bom);
        }
Beispiel #9
0
        /// <summary>
        /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.)
        /// </summary>
        /// <param name="mock">Object to be modified</param>
        static private void SetSpecialTestData(BillOfMaterials mock)
        {
            //Code your changes to the data object here.

            //Add 1 day to the StartDate.  EndDate has to be greater than start date
            mock.EndDate = mock.StartDate.AddDays(1);
        }
Beispiel #10
0
        ///<summary>
        ///  Update the Typed BillOfMaterials Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, BillOfMaterials mock)
        {
            BillOfMaterialsTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
Beispiel #11
0
        public override int GetHashCode()
        {
            int result = 31;

            result = 31 * result + BillOfMaterials.GetHashCode();
            result = 31 * result + Project.GetHashCode();
            result = 31 * result + Components.GetHashCode();
            return(result);
        }
Beispiel #12
0
        private void dgBOM_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            //更新
            string strCount = ((TextBox)e.Item.Cells[2].Controls[1]).Text;

            if (strCount == "")
            {
                Popup("请输入用量");
                return;
            }
            if (!Regex.IsMatch(strCount, @"^[+|-]{0,1}(\d*)\.{0,1}\d{0,}$"))
            {
                Popup("请输入数字");
                return;
            }
            string strCode = e.Item.Cells[5].Text;

            DataTable dtbom = null;

            if (Session["bom"] != null)
            {
                dtbom = (DataTable)Session["bom"];
            }
            else
            {
                Entity.BillOfMaterials bom = new BillOfMaterials();
                dtbom = bom.ToTable().Clone();
            }

            DataRow[] drboms = dtbom.Select("cnvcComponentInvCode='" + strCode + "'");
            if (drboms.Length > 0)
            {
                drboms[0]["cnnBaseQtyN"] = ((TextBox)e.Item.Cells[2].Controls[1]).Text;
            }
            else
            {
                DataRow drbom = dtbom.NewRow();
                drbom["cnvcComponentInvCode"] = strCode;
                drbom["cnnBaseQtyN"]          = ((TextBox)e.Item.Cells[2].Controls[1]).Text;
                dtbom.Rows.Add(drbom);
            }


            Session["bom"] = dtbom;

            DataTable dtchild = Session["child"] as DataTable;

            DataRow[] drchildren = dtchild.Select("cnvcInvCode='" + strCode + "'");
            if (drchildren.Length > 0)
            {
                drchildren[0]["cnnbaseQtyN"] = ((TextBox)e.Item.Cells[2].Controls[1]).Text;
            }
            Session["child"]         = dtchild;
            this.dgBOM.EditItemIndex = -1;
            BindChild();
        }
        public async Task <IActionResult> UpdateAsync(int id, [FromBody] BillOfMaterials bom)
        {
            var result = await _bomService.UpdateAsync(bom);

            if (result.Success)
            {
                return(Ok(JsonConvert.SerializeObject(result.Message)));
            }
            return(BadRequest(JsonConvert.SerializeObject(result.Message)));
        }
        public IActionResult Update(int id, [FromBody] BillOfMaterials bom)
        {
            var result = _bomService.Update(bom);

            if (result.Success)
            {
                return(Ok(JsonConvert.SerializeObject(result.Message)));
            }
            return(BadRequest(JsonConvert.SerializeObject(result.Message)));
        }
        public IActionResult Add(BillOfMaterials bom)
        {
            var result = _bomService.Add(bom);

            if (result.Success)
            {
                return(Ok(JsonConvert.SerializeObject(result.Message)));
            }
            return(BadRequest(JsonConvert.SerializeObject(result.Message)));
        }
Beispiel #16
0
 /// <summary>
 /// Gets and adds the missing Boms to the BillOfMaterials list
 /// </summary>
 /// <param name="componentNames"></param>
 private static void setMissingBoms(HashSet <string> componentNames)
 {
     foreach (var component in componentNames)
     {
         if (!BillOfMaterials.ContainsKey(component))
         {
             BillOfMaterial bom = AASRestClient.GetBillofmaterialWithRelationshipElements(component);
             BillOfMaterials.Add(component, bom);
         }
     }
 }
Beispiel #17
0
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                BillOfMaterials entity = mock.Copy() as BillOfMaterials;
                entity = (BillOfMaterials)mock.Clone();
                Assert.IsTrue(BillOfMaterials.ValueEquals(entity, mock), "Clone is not working");
            }
        }
Beispiel #18
0
        ///<summary>
        ///  Returns a Typed BillOfMaterials Entity with mock values.
        ///</summary>
        static public BillOfMaterials CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            BillOfMaterials mock = BillOfMaterialsTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return(mock);
        }
        public void IsValid_InvalidBillOfMaterials_True()
        {
            // Arrange/Act
            BillOfMaterials billOfMaterials = GetValidBillOfMaterials();

            billOfMaterials.Rectangles[0].Height = -10;

            bool isValid = billOfMaterialsValidator.IsValid(billOfMaterials);

            // Assert
            Assert.IsFalse(isValid, "Expected isValid to return false");
        }
Beispiel #20
0
        /// <summary>
        /// Check the foreign key dal methods.
        /// </summary>
        private void Step_10_FK_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                BillOfMaterials entity = CreateMockInstance(tm);
                bool            result = DataRepository.BillOfMaterialsProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test FK, Insert Failed");

                TList <BillOfMaterials> t0 = DataRepository.BillOfMaterialsProvider.GetByComponentId(tm, entity.ComponentId, 0, 10);
                TList <BillOfMaterials> t1 = DataRepository.BillOfMaterialsProvider.GetByProductAssemblyId(tm, entity.ProductAssemblyId, 0, 10);
            }
        }
Beispiel #21
0
        /// <summary>
        /// Serialize the mock BillOfMaterials entity into a temporary file.
        /// </summary>
        private void Step_06_SerializeEntity_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_BillOfMaterials.xml");

                EntityHelper.SerializeXml(mock, fileName);
                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found");

                System.Console.WriteLine("mock correctly serialized to a temporary file.");
            }
        }
        private void BindComponent()
        {
            BindGoodsName(ddlGoodsName);
            BindGoodsType(ddlGoodsType, ddlGoodsName.SelectedValue);

            //				string strBillNo = this.Request["BillNo"].ToString();
            //				string strDeptID = this.Request["DeptID"].ToString();
            BindLocalDept(this.txtDeptID, this.txtDeptName);
            BindSDept(ddlDeliveryCompany, this.txtDeptName.Text);

            BillOfMaterials bom = LoadObj("BOM") as BillOfMaterials;

            SetBOM(bom);
        }
Beispiel #23
0
 public void OutputBillOfMaterials(BillOfMaterials billOfMaterials)
 {
     try
     {
         if (systemSettingsWrapper.OutputToConsole)
         {
             consoleOutput.OutputBillOfMaterials(billOfMaterials);
         }
     }
     catch (Exception ex)
     {
         logWrapper.LogError($"Error outputting the bill of materials. Exception: {ex.Message}");
     }
 }
        public async Task <IActionResult> Create([Bind("BillOfMaterialsId,ProductAssemblyId,ComponentId,StartDate,EndDate,UnitMeasureCode,Bomlevel,PerAssemblyQty,ModifiedDate")] BillOfMaterials billOfMaterials)
        {
            if (ModelState.IsValid)
            {
                _context.Add(billOfMaterials);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ComponentId"]       = new SelectList(_context.Product, "ProductId", "Name", billOfMaterials.ComponentId);
            ViewData["ProductAssemblyId"] = new SelectList(_context.Product, "ProductId", "Name", billOfMaterials.ProductAssemblyId);
            ViewData["UnitMeasureCode"]   = new SelectList(_context.UnitMeasure, "UnitMeasureCode", "UnitMeasureCode", billOfMaterials.UnitMeasureCode);
            return(View(billOfMaterials));
        }
Beispiel #25
0
        /// <summary>
        /// Inserts a mock BillOfMaterials entity into the database.
        /// </summary>
        private void Step_01_Insert_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);
                Assert.IsTrue(DataRepository.BillOfMaterialsProvider.Insert(tm, mock), "Insert failed");

                System.Console.WriteLine("DataRepository.BillOfMaterialsProvider.Insert(mock):");
                System.Console.WriteLine(mock);

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
Beispiel #26
0
        /// <summary>
        /// Check the indexes dal methods.
        /// </summary>
        private void Step_11_IX_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                BillOfMaterials entity = CreateMockInstance(tm);
                bool            result = DataRepository.BillOfMaterialsProvider.Insert(tm, entity);

                Assert.IsTrue(result, "Could Not Test IX, Insert Failed");


                BillOfMaterials         t0 = DataRepository.BillOfMaterialsProvider.GetByProductAssemblyIdComponentIdStartDate(tm, entity.ProductAssemblyId, entity.ComponentId, entity.StartDate);
                TList <BillOfMaterials> t1 = DataRepository.BillOfMaterialsProvider.GetByUnitMeasureCode(tm, entity.UnitMeasureCode);
                BillOfMaterials         t2 = DataRepository.BillOfMaterialsProvider.GetByBillOfMaterialsId(tm, entity.BillOfMaterialsId);
            }
        }
        public bool IsValid(BillOfMaterials billOfMaterials)
        {
            logger.LogInfo("Beginning validation of next bill");

            foreach (Rectangle rectangle in billOfMaterials.Rectangles)
            {
                if (!ValidateWidget(rectangle))
                {
                    return(false);
                }
            }

            foreach (Square square in billOfMaterials.Squares)
            {
                if (!ValidateWidget(square))
                {
                    return(false);
                }
            }

            foreach (Ellipse elipse in billOfMaterials.Elipses)
            {
                if (!ValidateWidget(elipse))
                {
                    return(false);
                }
            }

            foreach (Circle circle in billOfMaterials.Circles)
            {
                if (!ValidateWidget(circle))
                {
                    return(false);
                }
            }

            foreach (Textbox textbox in billOfMaterials.Textboxes)
            {
                if (!ValidateWidget(textbox))
                {
                    return(false);
                }
            }

            logger.LogInfo("Finishing validation of bill");

            return(true);
        }
Beispiel #28
0
        /// <summary>
        /// Serialize a BillOfMaterials collection into a temporary file.
        /// </summary>
        private void Step_08_SerializeCollection_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_BillOfMaterialsCollection.xml");

                mock = CreateMockInstance(tm);
                TList <BillOfMaterials> mockCollection = new TList <BillOfMaterials>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<BillOfMaterials> correctly serialized to a temporary file.");
            }
        }
        public int UpdateBOM(OperLog operLog, string strinvcode, DataTable dtbom)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    //string strinvcode = "";
                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "delete from tbbillofmaterials where cnvcpartinvcode='" + strinvcode + "'");
                    foreach (DataRow drbom in dtbom.Rows)
                    {
                        Entity.BillOfMaterials bom = new BillOfMaterials(drbom);
                        EntityMapping.Create(bom, trans);
                    }
                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "存货编码:" + strinvcode;
                    EntityMapping.Create(operLog, trans);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    return(-1);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    return(-1);
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
                return(1);
            }
        }
Beispiel #30
0
        private void GetInv(string strinvcode)
        {
            string    strsql = "select * from tbinventory where cnvcinvcode='" + strinvcode + "'";
            DataTable dtInv  = Helper.Query(strsql);

            Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dtInv);
            Session["part"] = inv;

            strsql = "select * from tbinventory where cnvcinvcode in (select cnvcComponentInvCode from tbBillOfMaterials where cnvcPartInvcode='" + strinvcode + "')";
            DataTable dtchild = Helper.Query(strsql);

            Session["child"] = dtchild;

            strsql = "select * from tbBillOfMaterials where cnvcPartInvcode='" + strinvcode + "'";
            DataTable dtBOM = Helper.Query(strsql);

            Entity.BillOfMaterials bom = new BillOfMaterials(dtBOM);
            Session["BaseQtyD"] = bom.cnnBaseQtyD;
            Session["bom"]      = dtBOM;
        }
 /// <summary>
 /// There are no comments for BillOfMaterials in the schema.
 /// </summary>
 public void AddToBillOfMaterials(BillOfMaterials billOfMaterials)
 {
     base.AddObject("BillOfMaterials", billOfMaterials);
 }
 /// <summary>
 /// Create a new BillOfMaterials object.
 /// </summary>
 /// <param name="billOfMaterialsID">Initial value of BillOfMaterialsID.</param>
 /// <param name="startDate">Initial value of StartDate.</param>
 /// <param name="bOMLevel">Initial value of BOMLevel.</param>
 /// <param name="perAssemblyQty">Initial value of PerAssemblyQty.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static BillOfMaterials CreateBillOfMaterials(int billOfMaterialsID, global::System.DateTime startDate, short bOMLevel, decimal perAssemblyQty, global::System.DateTime modifiedDate)
 {
     BillOfMaterials billOfMaterials = new BillOfMaterials();
     billOfMaterials.BillOfMaterialsID = billOfMaterialsID;
     billOfMaterials.StartDate = startDate;
     billOfMaterials.BOMLevel = bOMLevel;
     billOfMaterials.PerAssemblyQty = perAssemblyQty;
     billOfMaterials.ModifiedDate = modifiedDate;
     return billOfMaterials;
 }