コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (GoodToGo())
            {
                var giService = new GrainInventoryService();
                // '1 - RECEIVE
                // '2 - SEND
                // '3 - USE
                // '4 - ADJUST

                if (isNewInventory)
                {
                    if (!Information.IsNothing(SelectedBag))
                    {
                        giService.InsertGrainInventory(UnitObj.CustomerId, SelectedBag.BagId, Conversions.ToSingle(lblTotalQuantity.Text), UnitObj.MiniUnitId);
                    }
                    else
                    {
                        giService.InsertGrainInventory(UnitObj.CustomerId, 0, Conversions.ToSingle(lblTotalQuantity.Text), UnitObj.MiniUnitId);
                    }

                    foreach (var grainLoc in GrainLocationList)
                    {
                        giService.InsertGrainInvStorageLocation(giService.GetLastGrainInvetoryId(), grainLoc.StorageTypeId, grainLoc.StorageId, (float)grainLoc.QtyInStorage, DateAndTime.Now);
                        giService.InsertGrainInventoryTransaction(giService.GetLastGrainInvetoryId(), 1, (float)grainLoc.QtyInStorage, DateAndTime.Now);
                        giService.InsertGrainInvTransactionGrainStorageLocation(giService.GetLastGrainInventoryTransactionId(), giService.GetLastGrainInvStorageLocationId());
                    }
                }

                My.MyProject.Forms.FrmGrainInvList.dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory();
                Close();
            }
        }
コード例 #2
0
 private void btnNewInventory_Click(object sender, EventArgs e)
 {
     My.MyProject.Forms.FrmAddEditGrainInventory.LoadForm();
     My.MyProject.Forms.FrmAddEditGrainInventory.isNewInventory = true;
     MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddEditGrainInventory, this);
     dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory();
 }
コード例 #3
0
        private void FrmGrainInvList_Load(object sender, EventArgs e)
        {
            firstLoad = true;
            var giService = new GrainInventoryService();

            dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory();
            using (var db = new WTCCeresEntities())
            {
                {
                    var withBlock  = cboCustomer;
                    var categories = new List <int>();
                    categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER);
                    categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER_VENDOR);
                    withBlock.DataSource    = CompanyService.GetByCompanyCategoryId(categories, db);
                    withBlock.DisplayMember = "CompanyName";
                    withBlock.ValueMember   = "CompanyId";
                }

                var exclusionList = new List <string>();
                exclusionList.Add("RELEASED");
                {
                    var withBlock1 = cboUnitNumber;
                    var newUs      = new VW_UnitSourceMiniUnit();
                    newUs.MiniunitNumber = "";
                    newUs.MiniUnitId     = 0;
                    var uslist = MiniUnitService.GetAll(exclusionList, db);
                    uslist.Insert(0, newUs);
                    withBlock1.DataSource    = uslist;
                    withBlock1.DisplayMember = "MiniUnitNumber";
                    withBlock1.ValueMember   = "MiniUnitId";
                    withBlock1.SelectedIndex = -1;
                }

                {
                    var withBlock2 = cboCommodity;
                    withBlock2.DataSource    = CommodityService.GetAll(db);
                    withBlock2.DisplayMember = "CommodityCode";
                    withBlock2.ValueMember   = "CommodityId";
                }

                {
                    var withBlock3 = cboGrade;
                    withBlock3.DataSource    = GradeService.GetAll(db);
                    withBlock3.DisplayMember = "GradeCode";
                    withBlock3.ValueMember   = "GradeId";
                }
            }

            firstLoad = false;
        }