Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string bagYear = "N/A";
            var    bs      = new BagInventoryService();

            if (isGoodToGo())
            {
                if (SaveBagImageLogo() == true)
                {
                    if (cbNoBagYear.Checked)
                    {
                        bagYear = "N/A";
                    }
                    else
                    {
                        bagYear = nudBagYear.Value.ToString();
                    }
                    if (isNewLogo)
                    {
                        bs.InsertBagLogo(bagYear, Strings.Trim(tbLogoDescription.Text), imagePath);
                    }
                    else
                    {
                        bs.UpdateBagLogo(SelectedLogoInfo.BagLogoId, Strings.Trim(tbLogoDescription.Text), bagYear, imagePath);
                    }

                    My.MyProject.Forms.FrmEditAddBags.dgvLogos.DataSource = BagInventoryService.GetAllBagLogos().Where(b => b.LogoDescription != "N/A").ToList();
                    Close();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error uploading image:", "There was a problem uploading the image into ftp server. If the issue persists, contact the IT department", this);
                }
            }
        }
Beispiel #2
0
 private void BunifuButton1_Click(object sender, EventArgs e)
 {
     My.MyProject.Forms.FrmEditAddBags.isNewInventory = true;
     My.MyProject.Forms.FrmEditAddBags.loadForm();
     MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditAddBags, this);
     VWBagBindingSource.DataSource = BagInventoryService.GetAllBags();
 }
Beispiel #3
0
 private void cboCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!firstLoad)
     {
         dgvInventory.DataSource = BagInventoryService.GetInventoryByFilters(cboCustomer.Text, tbBagName.Text, cboBagColor.Text, cboBagSize.Text);
     }
 }
Beispiel #4
0
        private void SaveUpdateInfo(bool isNewInventory)
        {
            var bs = new BagInventoryService();
            int bagId;

            if (!Information.IsNothing(selectedLogo))
            {
                if (isNewInventory)
                {
                    bs.InsertBag(Conversions.ToInteger(cboBagSize.SelectedValue), Conversions.ToInteger(cboBagWeight.SelectedValue), Conversions.ToInteger(cboBagColor.SelectedValue), Conversions.ToString(cboColortype.SelectedItem), selectedLogo.BagLogoId, tbBagDescription.Text);
                    bagId = bs.GetLastBagId();
                }
                else
                {
                    bs.UpdateBag(FocusedBagInv.BagId, Conversions.ToInteger(cboBagSize.SelectedValue), Conversions.ToInteger(cboBagWeight.SelectedValue), Conversions.ToInteger(cboBagColor.SelectedValue), Conversions.ToString(cboColortype.SelectedItem), selectedLogo.BagLogoId, tbBagDescription.Text);
                    // bs.UpdateBagLogo(selectedLogo.BagLogoId, selectedLogo.LogoDescription, selectedLogo.BagYear, selectedLogo.ImagePath)
                }
            }
            else if (isNewInventory)
            {
                bs.InsertBag(Conversions.ToInteger(cboBagSize.SelectedValue), Conversions.ToInteger(cboBagWeight.SelectedValue), Conversions.ToInteger(cboBagColor.SelectedValue), Conversions.ToString(cboColortype.SelectedItem), 0, tbBagDescription.Text);
                bagId = bs.GetLastBagId();
            }
            else
            {
                bs.UpdateBag(FocusedBagInv.BagId, Conversions.ToInteger(cboBagSize.SelectedValue), Conversions.ToInteger(cboBagWeight.SelectedValue), Conversions.ToInteger(cboBagColor.SelectedValue), Conversions.ToString(cboColortype.SelectedItem), 0, tbBagDescription.Text);
            }
        }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var bs = new BagInventoryService();
            VW_BookingBagInventoryAssignment bagAsnRecord;
            int bagInvTransId;

            if (goodToGo())
            {
                CalculateRemaining();

                // Insert new Inventory transaction
                bs.InsertBagInventoryTransaction(Conversions.ToInteger(cboAjustmentTyoe.SelectedValue), quantityAdjusted, DateAndTime.Now, Conversions.ToInteger(cboBagLocation.SelectedValue));
                bagInvTransId = bs.GetLastBagInventoryTransactionId();
                if (cboAjustmentTyoe.Text.Equals("USE"))
                {
                    // Add record of bag usage for booking
                    bagAsnRecord = BagInventoryService.GetBookingBagInvAsnmtByMbBag(Conversions.ToInteger(cboBookingNumber.SelectedValue), (int)focusedRow.BagInventoryId);
                    bs.InsertBookingBagUsage(bagAsnRecord.BookingBagAssignmentId, bagInvTransId);
                }
                else if (cboAjustmentTyoe.Text.Equals("RECEIVE"))
                {
                    // Update Initial quantity in BagInventory (make it Remaining + new receive value)
                    bs.UpdateBagInventory((int)focusedRow.BagInventoryId, focusedRow.CustomerId, focusedRow.BagId, newTotalInventory, DateAndTime.Now, true);
                }

                // Update bag uantity in storage location
                bs.UpdateBagLocation(bagLocationInfo.BagLocationId, (int)bagLocationInfo.BagInventoryId, bagLocationInfo.LocationStorageName, bagLocationInfo.StorageTypeId, (int)bagLocationInfo.StorageId, remainingInStorage);

                // Refresh DataSource in data grids
                My.MyProject.Forms.FrmEmptyBagInvList.dgvInventory.DataSource = BagInventoryService.GetAllInventory(true);
                My.MyProject.Forms.FrmEmptyBagInvList.dgvDetails.DataSource   = BagInventoryService.GetInventoryTransactionById((int)focusedRow.BagInventoryId);
                Close();
            }
        }
Beispiel #6
0
 private void cboBagWeight_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!firstLoad)
     {
         dgvBags.DataSource = BagInventoryService.GetAllBagsByFilter(tbBagName.Text, cboBagColor.Text, cboBagSize.Text, cboCustomerBag.Text);
     }
 }
Beispiel #7
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        public void PopulateInventoryInfo(VW_BagInventory InvInfo)
        {
            selectedInventory = InvInfo;
            var mdlFtp = new MdlFtp();

            lblCustomer.Text           = InvInfo.CustomerName;
            lblQuantity.Text           = InvInfo.TotalQuantity.ToString();
            lblRemaining.Text          = InvInfo.Remaining.ToString();
            lblStorageDate.Text        = InvInfo.StorageDate.ToString();
            dgvBagLocations.DataSource = BagInventoryService.GetBagLocationsByInvId((int)InvInfo.BagInventoryId);
            lblBagSize.Text            = InvInfo.BagSizeName;
            lblBagWeight.Text          = InvInfo.BagWeightName + " " + InvInfo.BagUnit;
            lblBagColor.Text           = InvInfo.BagColor;
            lblColorType.Text          = InvInfo.ColorType;
            lblBagDescription.Text     = InvInfo.BagDescription;
            lblLogoDescription.Text    = InvInfo.LogoDescription;
            lblLogoYear.Text           = InvInfo.BagYear;
            try
            {
                pbBagImage.Image = mdlFtp.GetFTPImage(InvInfo.ImagePath);
                if (!Information.IsNothing(pbBagImage.Image))
                {
                    // pbBagImage.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
                }
            }
            catch
            {
                if (!InvInfo.ImagePath.Equals("N/A"))
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error loading bag image", "The bag image is not accessible or does not exist on the ftp server.", My.MyProject.Forms.FrmParentScreen);
                }
            }
        }
Beispiel #8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (isGoodToGo())
     {
         SaveUpdateInfo(isNewInventory);
         My.MyProject.Forms.FrmEmptyBagInvList.dgvInventory.DataSource = BagInventoryService.GetAllInventory(true);
         Close();
     }
 }
Beispiel #9
0
 private void cboCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         btnChooseLogo.Enabled = true;
         dgvBags.DataSource    = BagInventoryService.GetAllBags();
     }
     catch
     {
         btnChooseLogo.Enabled = false;
     }
 }
Beispiel #10
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        public void loadForm()
        {
            lblWarning.Text = "";
            SelectedBag     = null;
            firstLoad       = true;
            BagLocationList.Clear();
            dgvBagLocations.DataSource = null;
            lblTotalBags.Text          = 0.ToString();
            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";
                    withBlock.SelectedItem  = "CompanyId";
                }

                {
                    var withBlock1 = cboBagSize;
                    var bagSizes   = BagInventoryService.GetAllBagSize();
                    withBlock1.DataSource    = bagSizes;
                    withBlock1.DisplayMember = "BagSizeName";
                    withBlock1.ValueMember   = "BagSizeId";
                    withBlock1.SelectedValue = 0;
                }

                {
                    var withBlock2 = cboBagColor;
                    withBlock2.DataSource    = BagInventoryService.GetAllColors();
                    withBlock2.DisplayMember = "ColorName";
                    withBlock2.ValueMember   = "ColorId";
                    withBlock2.SelectedValue = 0;
                }
            }

            panelBagsList.Hide();
            lblBagName.Text         = "--";
            lblBagSize.Text         = "--";
            lblBagWeight.Text       = "--";
            lblColorType.Text       = "--";
            lblBagColor.Text        = "--";
            lblLogoDescription.Text = "--";
            firstLoad = false;
        }
Beispiel #11
0
        private void FrmEmptyBagInvList_Load(object sender, EventArgs e)
        {
            firstLoad = true;
            var bagInventory = BagInventoryService.GetAllInventory(true);
            var listCan      = new List <VW_Container>();
            var listBagger   = new List <Bagger>();
            var locationList = new List <string>();

            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";
                    withBlock.SelectedItem  = "CompanyId";
                }

                {
                    var withBlock1 = cboBagSize;
                    var bagSizes   = BagInventoryService.GetAllBagSize();
                    withBlock1.DataSource    = bagSizes;
                    withBlock1.DisplayMember = "BagSizeName";
                    withBlock1.ValueMember   = "BagSizeId";
                    withBlock1.SelectedValue = 0;
                }

                {
                    var withBlock2 = cboBagColor;
                    withBlock2.DataSource    = BagInventoryService.GetAllColors();
                    withBlock2.DisplayMember = "ColorName";
                    withBlock2.ValueMember   = "ColorId";
                    withBlock2.SelectedValue = 0;
                }

                var delegationList = new List <string>();
                delegationList.Add("STORAGE");
                delegationList.Add("UNASSIGNED");
                listCan    = ContainerService.GetByFilters("", "", "", "", "", "", delegationList, "").Where(c => !string.IsNullOrEmpty(c.ContainerNumber)).ToList();
                listBagger = BagInventoryService.GetAllBaggers().ToList();
                dgvInventory.DataSource = BagInventoryService.GetInventoryByFilters(cboCustomer.Text, tbBagName.Text, cboBagColor.Text, cboBagSize.Text);
                firstLoad = false;
            }
        }
Beispiel #12
0
        private void FrmAdjustBagsInventoryQty_Load(object sender, EventArgs e)
        {
            {
                var withBlock = cboAjustmentTyoe;
                withBlock.DataSource    = BagInventoryService.GetAllTransactionsType(); // .Where(Function(b) ({"USE", "ADJUST", "SEND"}).Contains(b.TransactionTypeName)).ToList
                withBlock.DisplayMember = "TransactionTypeName";
                withBlock.ValueMember   = "TransactionTypeId";
            }

            focusedRow = (VW_BagInventory)My.MyProject.Forms.FrmEmptyBagInvList.dgvInventory.Rows[My.MyProject.Forms.FrmEmptyBagInvList.dgvInventory.CurrentRow.Index].DataBoundItem;
            {
                var withBlock1 = cboBagLocation;
                withBlock1.DataSource    = BagInventoryService.GetBagLocationsByInvId((int)focusedRow.BagInventoryId);
                withBlock1.DisplayMember = "LocationStorageName";
                withBlock1.ValueMember   = "BagLocationId";
            }

            btnSave.Enabled = false;
        }
Beispiel #13
0
        private void SaveUpdateInfo(bool isNewInventory)
        {
            var bs = new BagInventoryService();
            int inventoryId;
            int canId;
            int baggerId;
            int lastBagLocationIserted = 0;

            if (isNewInventory)
            {
                // '1 - RECEIVE
                // '2 - SEND
                // '3 - USE
                // '4 - ADJUST

                bs.InsertBagInventory(Conversions.ToInteger(cboCustomer.SelectedValue), SelectedBag.BagId, Conversions.ToInteger(lblTotalBags.Text), dtpStorage.Value, Conversions.ToBoolean(1));
                inventoryId = bs.GetLastBagInventoryId();
                foreach (var bag in BagLocationList)
                {
                    bs.InsertBagLocation(inventoryId, bag.LocationStorageName, bag.StorageTypeId, (int)bag.StorageId, bag.BagQuantity);
                    lastBagLocationIserted = bs.GetLastBagLocationId();
                    bs.InsertBagInventoryTransaction(1, bag.BagQuantity, DateAndTime.Now, lastBagLocationIserted);
                }
            }
            else
            {
                bs.UpdateBagInventory((int)FocusedBagInv.BagInventoryId, Conversions.ToInteger(cboCustomer.SelectedValue), SelectedBag.BagId, Conversions.ToInteger(lblTotalBags.Text), dtpStorage.Value, Conversions.ToBoolean(1));
                foreach (var bag in BagLocationList)
                {
                    if (!Information.IsNothing(bag.BagInventoryId))
                    {
                        bs.UpdateBagLocation(bag.BagLocationId, (int)FocusedBagInv.BagInventoryId, bag.LocationStorageName, bag.StorageTypeId, (int)bag.StorageId, bag.BagQuantity);
                    }
                    else
                    {
                        bs.InsertBagLocation((int)FocusedBagInv.BagInventoryId, bag.LocationStorageName, bag.StorageTypeId, (int)bag.StorageId, bag.BagQuantity);
                        lastBagLocationIserted = bs.GetLastBagLocationId();
                        bs.InsertBagInventoryTransaction(1, bag.BagQuantity, DateAndTime.Now, lastBagLocationIserted);
                    }
                }
            }
        }
Beispiel #14
0
        public void LoadEditInfo(VW_Bag BagInfo)
        {
            FocusedBagInv = BagInfo;
            // cboCustomer.SelectedValue = BagInfo.CustomerId

            cboBagSize.SelectedValue   = BagInfo.BagSizeId;
            cboBagWeight.SelectedValue = BagInfo.BagWeightId;
            cboBagColor.SelectedValue  = BagInfo.ColorId;
            cboColortype.SelectedItem  = BagInfo.ColorType;
            tbBagDescription.Text      = BagInfo.BagDescription;
            string path = "Operations/EmptyBags/BagPictures";
            var    ftp  = new MdlFtp();

            if (!BagInfo.ImagePath.Equals("N/A"))
            {
                selectedLogo = BagInventoryService.GetBagLogoById(BagInfo.BagLogoId);
                var image = ftp.GetFTPImage(BagInfo.ImagePath);
                pbLogo.Image = image;
            }
        }
Beispiel #15
0
        public void LoadEditInfo(VW_BagInventory BagInfo)
        {
            FocusedBagInv             = BagInfo;
            cboCustomer.SelectedValue = BagInfo.CustomerId;
            cboBagSize.SelectedValue  = BagInfo.BagSizeId;
            cboBagColor.SelectedValue = BagInfo.ColorId;

            // cboLocation.SelectedValue = BagInfo.StorageId

            lblTotalBags.Text = BagInfo.TotalQuantity.ToString();
            dtpStorage.Value  = (DateTime)BagInfo.StorageDate;

            // tbLocation.Text = BagInfo.LocationTag

            dgvBags.DataSource = BagInventoryService.GetAllBags();
            SelectedBag        = BagInventoryService.GetBagVWById(BagInfo.BagId);
            var bagsLocations = BagInventoryService.GetBagLocationsByInvId((int)BagInfo.BagInventoryId);

            dgvBagLocations.DataSource = bagsLocations;
            BagLocationList            = bagsLocations;
            populateBagInfoLbls();
        }
Beispiel #16
0
        public void LoadForm()
        {
            firstLoad = true;
            exclusionList.Clear();
            GrainLocationList.Clear();
            VWBagBindingSource.DataSource = BagInventoryService.GetAllBags();
            dtpStorage.Value       = DateAndTime.Now;
            SelectedBag            = null;
            lblCustomer.Text       = "";
            lblCargoType.Text      = "";
            lblCommodityGrade.Text = "";
            dgvGrainLocations.Rows.Clear();
            exclusionList.Add("RELEASED");
            {
                var withBlock = cboUnitSources;
                withBlock.DataSource    = MiniUnitService.GetAll(exclusionList);
                withBlock.DisplayMember = "MiniUnitNumber";
                withBlock.ValueMember   = "MiniUnitId";
            }

            cboUnitSources.SelectedIndex = -1;
            firstLoad = false;
        }
Beispiel #17
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        public void loadForm()
        {
            {
                var withBlock = cboBagSize;
                withBlock.DataSource    = BagInventoryService.GetAllBagSize();
                withBlock.DisplayMember = "BagSizeName";
                withBlock.ValueMember   = "BagSizeId";
            }

            {
                var withBlock1 = cboBagWeight;
                withBlock1.DataSource    = BagInventoryService.GetAllBagWeights();
                withBlock1.DisplayMember = "BagWeightName";
                withBlock1.ValueMember   = "BagWeightId";
            }

            {
                var withBlock2 = cboBagColor;
                withBlock2.DataSource    = BagInventoryService.GetAllColors();
                withBlock2.DisplayMember = "ColorName";
                withBlock2.ValueMember   = "ColorId";
            }

            {
                var withBlock3 = cboColortype;
                withBlock3.Items.Clear();
                withBlock3.Items.Add("Solid");
                withBlock3.Items.Add("Multicolor");
                withBlock3.SelectedIndex = 0;
            }

            dgvLogos.DataSource   = BagInventoryService.GetAllBagLogos().Where(b => b.LogoDescription != "N/A").ToList();
            selectedLogo          = null;
            tbBagDescription.Text = "";
            lblWarning.Text       = "";
            pbLogo.Image          = null;
        }
Beispiel #18
0
        private void CalculateRemaining()
        {
            if (!Information.IsNothing(focusedRow))
            {
                switch (cboAjustmentTyoe.Text ?? "")
                {
                case "ADJUST":
                {
                    pnlAdjust.Show();
                    pnlAdjust.BringToFront();
                    if (rbIncrease.Checked)
                    {
                        lblPlusMinus.Text  = "+";
                        lblTotal.Text      = (bagLocationInfo.BagQuantity + nudQuantity.Value).ToString();
                        quantityAdjusted   = (int)Math.Round(nudQuantity.Value);
                        newTotalInventory  = (int)(focusedRow.Remaining + nudQuantity.Value);
                        remainingInStorage = (int)Math.Round(bagLocationInfo.BagQuantity + nudQuantity.Value);
                    }
                    else if (rbDecrease.Checked)
                    {
                        lblPlusMinus.Text  = "-";
                        lblTotal.Text      = (bagLocationInfo.BagQuantity - nudQuantity.Value).ToString();
                        quantityAdjusted   = (int)Math.Round(-nudQuantity.Value);
                        newTotalInventory  = (int)(focusedRow.Remaining - nudQuantity.Value);
                        remainingInStorage = (int)Math.Round(bagLocationInfo.BagQuantity - nudQuantity.Value);
                    }

                    break;
                }

                case "USE":
                {
                    pnlBooking.Show();
                    pnlBooking.BringToFront();
                    {
                        var withBlock = cboBookingNumber;
                        withBlock.DataSource    = BagInventoryService.GetBookingBagInvAsnmtByBag((int)focusedRow.BagInventoryId);
                        withBlock.DisplayMember = "BookingNumber";
                        withBlock.ValueMember   = "MinibookingId";
                    }

                    lblPlusMinus.Text  = "-";
                    lblTotal.Text      = (bagLocationInfo.BagQuantity - nudQuantity.Value).ToString();
                    quantityAdjusted   = (int)Math.Round(-nudQuantity.Value);
                    newTotalInventory  = (int)(focusedRow.Remaining - nudQuantity.Value);
                    remainingInStorage = (int)Math.Round(bagLocationInfo.BagQuantity - nudQuantity.Value);
                    break;
                }

                case var @case when @case == "SEND":
                {
                    lblPlusMinus.Text  = "-";
                    lblTotal.Text      = (bagLocationInfo.BagQuantity - nudQuantity.Value).ToString();
                    quantityAdjusted   = (int)Math.Round(-nudQuantity.Value);
                    newTotalInventory  = (int)(focusedRow.Remaining - nudQuantity.Value);
                    remainingInStorage = (int)Math.Round(bagLocationInfo.BagQuantity - nudQuantity.Value);
                    break;
                }

                case "RECEIVE":
                {
                    lblPlusMinus.Text  = "+";
                    lblTotal.Text      = (bagLocationInfo.BagQuantity + nudQuantity.Value).ToString();
                    quantityAdjusted   = (int)Math.Round(nudQuantity.Value);
                    newTotalInventory  = (int)(focusedRow.Remaining + nudQuantity.Value);
                    remainingInStorage = (int)Math.Round(bagLocationInfo.BagQuantity + nudQuantity.Value);
                    break;
                }
                }

                lblQtyUsed.Text = nudQuantity.Value.ToString();
                if ((focusedRow.Remaining - nudQuantity.Value >= 0 & nudQuantity.Value > 0m) == true)
                {
                    btnSave.Enabled = true;
                }
                else
                {
                    btnSave.Enabled = false;
                }
            }
        }
Beispiel #19
0
 private void dgv_SelectionChanged(object sender, EventArgs e)
 {
     focusedRow            = (VW_BagInventory)dgvInventory.Rows[dgvInventory.CurrentRow.Index].DataBoundItem;
     dgvDetails.DataSource = BagInventoryService.GetInventoryTransactionById((int)focusedRow.BagInventoryId);
 }
Beispiel #20
0
 private void tbBagName_TextChanged(object sender, EventArgs e)
 {
     VWBagBindingSource.DataSource = BagInventoryService.GetAllBagsByFilter(tbBagName.Text, "", "", "");
 }