コード例 #1
0
        private void toolImport_Click(object sender, EventArgs e)
        {
            try
            {
                frmSelectGrid   frmsel = new frmSelectGrid();
                frmSingleSelect frms   = new frmSingleSelect();
                frms.InitData("请选择导入方式:", "客户订单,采购单", "客户订单", ComboBoxStyle.DropDownList);
                if (frms.ShowDialog() == DialogResult.OK)
                {
                    switch (Util.retValue1)
                    {
                    case "客户订单":
                        dalCustomerOrderList dalorder = new dalCustomerOrderList();
                        BindingCollection <modCustomerOrderList> listorder = dalorder.GetIList(false, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listorder != null)
                        {
                            frmsel.InitViewList("请选择要导入的客户订单号:", listorder);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditSalesShipment frm = new EditSalesShipment();
                                frm.ImportItem(Util.retValue1, frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;

                    case "采购单":
                        dalPurchaseList dal = new dalPurchaseList();
                        BindingCollection <modPurchaseList> list = dal.GetIList(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (list != null)
                        {
                            frmsel.InitViewList("请选择要导入的采购单号:", list);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditSalesShipment frm = new EditSalesShipment();
                                frm.ImportItem(Util.retValue1, frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
 private void LoadData()
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         DBGrid.toolCancelFrozen_Click(null, null);
         BindingCollection <modPurchaseList> list = _dal.GetIList(rbStatus0.Checked ? "0" : "1", string.Empty, string.Empty, string.Empty, string.Empty, rbStatus0.Checked ? string.Empty : dtpFrom.Text, rbStatus0.Checked ? string.Empty : dtpTo.Text, out Util.emsg);
         DBGrid.DataSource = list;
         if (list == null && !string.IsNullOrEmpty(Util.emsg))
         {
             MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             AddComboBoxColumns();
             DBGrid.ReadOnly = false;
             for (int i = 0; i < DBGrid.ColumnCount; i++)
             {
                 DBGrid.Columns[i].ReadOnly = true;
             }
             DBGrid.Columns["PayStatus"].ReadOnly     = false;
             DBGrid.Columns["PayDate"].ReadOnly       = false;
             DBGrid.Columns["AccountNo"].ReadOnly     = false;
             DBGrid.Columns["InvoiceStatus"].ReadOnly = false;
             DBGrid.Columns["InvoiceNo"].ReadOnly     = false;
             DBGrid.Columns["InvoiceMny"].ReadOnly    = false;
             ShowColor();
             string[] showcell = { "AccountNo" };
             DBGrid.SetParam(showcell);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }