Exemple #1
0
        private void LoadItemSuppliers(int itemId)
        {
            mItemSuppliersTbl.Clear();

            DataTable dtSuppliers = ItemSupplierDAL.GetAllItemSuppliersByItemId(itemId);

            foreach (DataRow row in dtSuppliers.Rows)
            {
                int          supplierId = StringUtil.GetSafeInt(row["SupplierId"]);
                SupplierType supplier   = SupplierDAL.GetSupplierById(supplierId);
                if (supplier == null)
                {
                    continue;
                }
                DataRow rowLoc = mItemSuppliersTbl.NewRow();
                rowLoc["SupplierId"]   = supplierId;
                rowLoc["SupplierName"] = supplier.SupplierName;
                rowLoc["URL"]          = StringUtil.GetSafeString(row["SouringURL"]);
                rowLoc["Price"]        = StringUtil.GetSafeDouble(row["Price"]);
                rowLoc["ShippingFee"]  = StringUtil.GetSafeDouble(row["ShippingFee"]);
                rowLoc["Comment"]      = StringUtil.GetSafeString(row["Comment"]);
                mItemSuppliersTbl.Rows.Add(rowLoc);
            }

            this.dgvItemSuppliers.DataSource = mItemSuppliersTbl;
        }
Exemple #2
0
        private void ToolStripMenuItemDelSupplier_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("你确认刪除该供应商么?\r\n删除前,必须删除所有该供应商的采购单。",
                                "确认发货?",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            // Check if any sourcing notes related to this supplier, if so, disallow delete.
            // [ZHI_TODO]

            int rowIdx     = this.pagedDgvSupplier.DgvData.CurrentRow.Index;
            int supplierId = StringUtil.GetSafeInt(this.pagedDgvSupplier.DgvData.Rows[rowIdx].Cells[0].Value.ToString());

            SupplierType supplier = SupplierDAL.GetSupplierById(supplierId);

            if (supplier == null)
            {
                return;
            }

            SupplierDAL.DeleteOneSupplier(supplierId);
            MessageBox.Show(String.Format("删除供应商成功!", supplier.SupplierName),
                            "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.pagedDgvSupplier.LoadData();
        }
Exemple #3
0
        private void LoadExistingSourcingNote()
        {
            if (mSourcingNote == null)
            {
                return;
            }

            SupplierType supplier = SupplierDAL.GetSupplierById(mSourcingNote.SupplierId);

            if (supplier == null)
            {
                return;
            }

            mSupplier = supplier;

            this.textBoxSupplier.Text     = supplier.SupplierName;
            this.textBoxExtraFee.Text     = mSourcingNote.ExtraFee.ToString();
            this.textBoxShippingFee.Text  = mSourcingNote.ShippingFee.ToString();
            this.textBoxTotalFee.Text     = mSourcingNote.TotalFee.ToString();
            this.textBoxComment.Text      = mSourcingNote.Comment;
            this.dateTimePickerDate.Value = mSourcingNote.SourcingDate;

            String skuListStr   = mSourcingNote.ItemSkuList;
            String numListStr   = mSourcingNote.ItemNumList;
            String priceListStr = mSourcingNote.ItemPriceList;

            String [] skuArr   = skuListStr.Split(new char[] { ',' });
            String [] numArr   = numListStr.Split(new char[] { ',' });
            String[]  priceArr = priceListStr.Split(new char[] { ',' });

            if (skuArr.Length != numArr.Length || skuArr.Length != priceArr.Length)
            {
                return;
            }

            for (int ii = 0; ii < skuArr.Length; ++ii)
            {
                String            sku  = skuArr[ii];
                InventoryItemType item = ItemDAL.GetItemBySKU(sku);
                if (item == null)
                {
                    continue;
                }

                DataRow dr = mItemsTable.NewRow();
                dr["ItemSKU"]   = sku;
                dr["ItemName"]  = item.ItemName;
                dr["ItemPrice"] = StringUtil.GetSafeDouble(priceArr[ii]);
                dr["ItemCount"] = StringUtil.GetSafeInt(numArr[ii]);

                mItemsTable.Rows.Add(dr);
            }

            this.dgvItems.DataSource = mItemsTable;
        }
Exemple #4
0
        void DgvData_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            foreach (DataGridViewRow row in pagedDgvSourcingNote.DgvData.Rows)
            {
                int          supplierId = StringUtil.GetSafeInt(row.Cells[1].Value);
                SupplierType supplier   = SupplierDAL.GetSupplierById(supplierId);

                if (supplier == null)
                {
                    continue;
                }

                row.Cells[2].Value = supplier.SupplierName;
            }
        }
        private void ShowSupplierData()
        {
            SupplierType supplier = SupplierDAL.GetSupplierById(mSupplierId);

            if (supplier == null)
            {
                MessageBox.Show("无供应商信息", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.textBoxSupplierName.Text    = supplier.SupplierName;
            this.textBoxSupplierTel.Text     = supplier.SupplierTel;
            this.textBoxSupplierLink1.Text   = supplier.SupplierLink1;
            this.textBoxSupplierLink2.Text   = supplier.SupplierLink2;
            this.textBoxSupplierLink3.Text   = supplier.SupplierLink3;
            this.textBoxSupplierComment.Text = supplier.Comment;
        }
Exemple #6
0
        private void ToolStripMenuItemEditSupplier_Click(object sender, EventArgs e)
        {
            int rowIdx     = this.pagedDgvSupplier.DgvData.CurrentRow.Index;
            int supplierId = StringUtil.GetSafeInt(this.pagedDgvSupplier.DgvData.Rows[rowIdx].Cells[0].Value.ToString());

            SupplierType supplier = SupplierDAL.GetSupplierById(supplierId);

            if (supplier == null)
            {
                return;
            }

            FrmEditSupplier frmEditSupplier = new FrmEditSupplier(supplierId);

            frmEditSupplier.ShowDialog();

            this.pagedDgvSupplier.LoadData();
        }
Exemple #7
0
        private void btnFinishSelecting_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = this.pagedDgvSupplier.DgvData.CurrentRow;

            if (row == null)
            {
                MessageBox.Show("未选中任何供应商", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int supplierId = StringUtil.GetSafeInt(row.Cells[0].Value);

            mSelectedSupplier = SupplierDAL.GetSupplierById(supplierId);
            if (mSelectedSupplier == null)
            {
                MessageBox.Show("未选中任何供应商", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.Close();
        }