Exemplo n.º 1
0
        private void LoadData()
        {
            BindingCollection <modVendorList> list = _dal.GetIList(string.Empty, string.Empty, out Util.emsg);

            DBGrid.DataSource = list;
            DBGrid.Enabled    = true;
            if (list != null)
            {
                AddComboBoxColumns();
                Status1 = DBGrid.Rows.Count.ToString();
                Status2 = clsTranslate.TranslateString("Refresh");
            }
            else
            {
                DBGrid.DataSource = null;
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 2
0
        private void mnuNewVendorOrderList_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (DBGrid.CurrentRow == null)
                {
                    return;
                }

                string selectionlist = string.Empty;

                dalVendorList dalvendor = new dalVendorList();
                BindingCollection <modVendorList> listvendor = dalvendor.GetIList("1", string.Empty, out Util.emsg);
                if (listvendor != null)
                {
                    frmSingleSelect frm = new frmSingleSelect();
                    frm.InitViewList("请选择供应商", listvendor, "VendorName", "VendorName", ComboBoxStyle.DropDown);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        modVendorList modvendor = dalvendor.GetItem(Util.retValue1, out Util.emsg);
                        BindingCollection <modVendorOrderList> list = new BindingCollection <modVendorOrderList>();
                        if (DBGrid.SelectedRows.Count == 0)
                        {
                            modCustomerOrderList modco = (modCustomerOrderList)DBGrid.CurrentRow.DataBoundItem;
                            modVendorOrderList   mod   = new modVendorOrderList();
                            mod.Id          = 0;
                            mod.FormDate    = DateTime.Today;
                            mod.RequireDate = DateTime.Today;
                            //mod.VendorOrderNo = modco.CustOrderNo;
                            mod.Remark      = modco.CustName + ": " + modco.CustOrderNo;
                            mod.VendorName  = Util.retValue1;
                            mod.PayMethod   = string.Empty;
                            mod.PurchaseMan = Util.UserId;
                            mod.ProductId   = modco.ProductId;
                            mod.ProductName = modco.ProductName;
                            if (clsLxms.GetProductSizeFlag(mod.ProductId) == 0)
                            {
                                mod.Size = 1;
                            }
                            else
                            {
                                mod.Size = modco.Size;
                            }
                            mod.Currency   = modvendor.Currency;
                            mod.UnitNo     = modco.UnitNo;
                            mod.Qty        = modco.Qty;
                            mod.Price      = 0;
                            mod.UpdateUser = Util.UserId;
                            list.Add(mod);
                        }
                        else
                        {
                            for (int i = 0; i < DBGrid.SelectedRows.Count; i++)
                            {
                                if (DBGrid.SelectedRows[i].Visible)
                                {
                                    modCustomerOrderList modco = (modCustomerOrderList)DBGrid.SelectedRows[i].DataBoundItem;
                                    modVendorOrderList   mod   = new modVendorOrderList();
                                    mod.Id          = 0;
                                    mod.FormDate    = DateTime.Today;
                                    mod.RequireDate = DateTime.Today;
                                    //mod.VendorOrderNo = modco.CustOrderNo;
                                    mod.Remark      = modco.CustName + ": " + modco.CustOrderNo;
                                    mod.VendorName  = Util.retValue1;
                                    mod.PayMethod   = string.Empty;
                                    mod.PurchaseMan = Util.UserId;
                                    mod.ProductId   = modco.ProductId;
                                    mod.ProductName = modco.ProductName;
                                    if (clsLxms.GetProductSizeFlag(mod.ProductId) == 0)
                                    {
                                        mod.Size = 1;
                                    }
                                    else
                                    {
                                        mod.Size = modco.Size;
                                    }
                                    mod.Currency   = modvendor.Currency;
                                    mod.UnitNo     = modco.UnitNo;
                                    mod.Qty        = modco.Qty;
                                    mod.Price      = 0;
                                    mod.UpdateUser = Util.UserId;
                                    list.Add(mod);
                                }
                            }
                        }
                        VendorOrderImport frmImport = new VendorOrderImport();
                        frmImport.InitViewList(list);
                        frmImport.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 3
0
        private void cboBookType_SelectedIndexChanged(object sender, EventArgs e)
        {
            prepared          = false;
            DBGrid.DataSource = null;
            switch (cboBookType.SelectedIndex)
            {
            case 0:
                dalCustomerList dalCust = new dalCustomerList();
                BindingCollection <modCustomerSimpleList> listCust = dalCust.GetSimpleList(out Util.emsg);
                DBGrid.DataSource = listCust;
                if (listCust != null)
                {
                    for (int i = 2; i < DBGrid.ColumnCount; i++)
                    {
                        DBGrid.Columns[i].Visible = false;
                    }
                    DBGrid.Columns[0].Width = 90;
                    DBGrid.Columns[1].Width = DBGrid.Width - 140;
                }
                break;

            case 1:
                dalVendorList dalVendor = new dalVendorList();
                BindingCollection <modVendorList> listVendor = dalVendor.GetIList("1", string.Empty, out Util.emsg);
                DBGrid.DataSource = listVendor;
                if (listVendor != null)
                {
                    for (int i = 1; i < DBGrid.ColumnCount; i++)
                    {
                        DBGrid.Columns[i].Visible = false;
                    }
                    DBGrid.Columns[0].Width = DBGrid.Width - 50;
                }
                break;

            case 2:
                dalOtherReceivableObject dalORec = new dalOtherReceivableObject();
                BindingCollection <modOtherReceivableObject> listORec = dalORec.GetIList(true, out Util.emsg);
                DBGrid.DataSource = listORec;
                if (listORec != null)
                {
                    for (int i = 1; i < DBGrid.ColumnCount; i++)
                    {
                        DBGrid.Columns[i].Visible = false;
                    }
                    DBGrid.Columns[0].Width = DBGrid.Width - 50;
                }
                break;

            case 3:
                dalOtherPayableObject dalOPay = new dalOtherPayableObject();
                BindingCollection <modOtherPayableObject> listOPay = dalOPay.GetIList(true, out Util.emsg);
                DBGrid.DataSource = listOPay;
                if (listOPay != null)
                {
                    for (int i = 1; i < DBGrid.ColumnCount; i++)
                    {
                        DBGrid.Columns[i].Visible = false;
                    }
                    DBGrid.Columns[0].Width = DBGrid.Width - 50;
                }
                break;

            case 4:
                dalAccBankAccount dalCash = new dalAccBankAccount();
                BindingCollection <modAccBankAccount> listCash = dalCash.GetIList(out Util.emsg);
                DBGrid.DataSource = listCash;
                if (listCash != null)
                {
                    for (int i = 2; i < DBGrid.ColumnCount; i++)
                    {
                        DBGrid.Columns[i].Visible = false;
                    }
                    DBGrid.Columns[0].Width = 90;
                    DBGrid.Columns[1].Width = DBGrid.Width - 140;
                }
                break;
            }
            prepared = true;
        }
Exemplo n.º 4
0
        private void toolImport_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                frmSingleSelect frm       = new frmSingleSelect();
                dalVendorList   dalvendor = new dalVendorList();
                BindingCollection <modVendorList> listvendor = dalvendor.GetIList("1", string.Empty, out Util.emsg);
                if (listvendor != null)
                {
                    frm.InitViewList("请选择供应商", listvendor, "VendorName", "VendorName", ComboBoxStyle.DropDown);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        modVendorList modvendor = dalvendor.GetItem(Util.retValue1, out Util.emsg);
                        frmSelectGrid frmsel    = new frmSelectGrid();

                        dalPurchaseList dalorder = new dalPurchaseList();
                        BindingCollection <modCustomerOrderList> listorder = dalorder.GetImportOrderData(DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listorder != null)
                        {
                            frmsel.InitViewList("请选择要导入的客户订单号:", listorder);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                BindingCollection <modVendorOrderList> list = new BindingCollection <modVendorOrderList>();
                                dalCustomerOrderList dalco = new dalCustomerOrderList();
                                BindingCollection <modCustomerOrderList> listco = dalco.GetIList(frmSelectGrid.selectionlist, out Util.emsg);
                                foreach (modCustomerOrderList modco in listco)
                                {
                                    modVendorOrderList mod = new modVendorOrderList();
                                    mod.Id          = 0;
                                    mod.FormDate    = DateTime.Today;
                                    mod.RequireDate = DateTime.Today;
                                    //mod.VendorOrderNo = modco.CustOrderNo;
                                    mod.Remark      = modco.CustName + ": " + modco.CustOrderNo;
                                    mod.VendorName  = Util.retValue1;
                                    mod.PayMethod   = string.Empty;
                                    mod.PurchaseMan = Util.UserId;
                                    mod.ProductId   = modco.ProductId;
                                    mod.ProductName = modco.ProductName;
                                    if (clsLxms.GetProductSizeFlag(mod.ProductId) == 0)
                                    {
                                        mod.Size = 1;
                                    }
                                    else
                                    {
                                        mod.Size = modco.Size;
                                    }
                                    mod.Currency   = modvendor.Currency;
                                    mod.UnitNo     = modco.UnitNo;
                                    mod.Qty        = modco.Qty;
                                    mod.Price      = 0;
                                    mod.UpdateUser = Util.UserId;
                                    list.Add(mod);
                                }
                                VendorOrderImport frmImport = new VendorOrderImport();
                                frmImport.InitViewList(list);
                                if (frmImport.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }