コード例 #1
0
 private void toolEdit_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (DBGrid.CurrentRow == null)
         {
             return;
         }
         modPurchaseList  mod = (modPurchaseList)DBGrid.CurrentRow.DataBoundItem;
         EditPurchaseList frm = new EditPurchaseList();
         frm.EditItem(mod.PurchaseId);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             LoadData();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
コード例 #2
0
 private void toolNew_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         EditPurchaseList frm = new EditPurchaseList();
         frm.AddItem(Util.retValue1);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             rbStatus0.Checked = true;
             LoadData();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
コード例 #3
0
ファイル: frmViewList.cs プロジェクト: 100009/hberp
        private void DBGrid_DoubleClick(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            if (_selection)
            {
                Util.retValue1 = DBGrid.CurrentRow.Cells[0].Value.ToString();
                if (DBGrid.ColumnCount >= 2)
                {
                    Util.retValue2 = DBGrid.CurrentRow.Cells[1].Value.ToString();
                }
                if (DBGrid.ColumnCount >= 3)
                {
                    Util.retValue3 = DBGrid.CurrentRow.Cells[2].Value.ToString();
                }
                if (DBGrid.ColumnCount >= 4)
                {
                    Util.retValue4 = DBGrid.CurrentRow.Cells[3].Value.ToString();
                }
                if (DBGrid.ColumnCount >= 5)
                {
                    Util.retValue5 = DBGrid.CurrentRow.Cells[4].Value.ToString();
                }
                this.DialogResult = DialogResult.OK;
                this.Dispose();
            }
            else
            {
                if (DBGrid.ColumnCount > 0)
                {
                    bool formtype = false, formid = false;
                    for (int i = 0; i < DBGrid.ColumnCount; i++)
                    {
                        if (DBGrid.Columns[i].Name.ToLower().CompareTo("formtype") == 0)
                        {
                            formtype = true;
                        }
                        if (DBGrid.Columns[i].Name.ToLower().CompareTo("formid") == 0)
                        {
                            formid = true;
                        }
                    }

                    if (formtype && formid)
                    {
                        switch (DBGrid.CurrentRow.Cells["formtype"].Value.ToString())
                        {
                        case "送货单":
                        case "收营单":
                        case "退货单":
                            EditSalesShipment frmss = new EditSalesShipment();
                            frmss.EditItem(DBGrid.CurrentRow.Cells["formid"].Value.ToString());
                            frmss.ShowDialog();
                            break;

                        case "采购收货":
                        case "采购退货":
                            EditPurchaseList frmpur = new EditPurchaseList();
                            frmpur.EditItem(DBGrid.CurrentRow.Cells["formid"].Value.ToString());
                            frmpur.ShowDialog();
                            break;

                        case "生产领料出库":
                        case "损耗出库":
                        case "借入物出库":
                        case "借出物出库":
                        case "生产商品入库":
                        case "溢余入库":
                        case "借入物入库":
                        case "借出物入库":
                            EditWarehouseInout frmio = new EditWarehouseInout();
                            frmio.EditItem(Convert.ToInt32(DBGrid.CurrentRow.Cells["formid"].Value));
                            frmio.ShowDialog();
                            break;
                        }
                    }
                }
            }
        }
コード例 #4
0
        private void mnuNewPurchaseList_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (DBGrid.CurrentRow == null)
                {
                    return;
                }

                string selectionlist = string.Empty;
                if (DBGrid.SelectedRows.Count == 0)
                {
                    for (int i = 0; i < DBGrid.RowCount; i++)
                    {
                        if (DBGrid.Rows[i].Visible)
                        {
                            if (string.IsNullOrEmpty(selectionlist))
                            {
                                selectionlist = DBGrid.Rows[i].Cells["Id"].Value.ToString();
                            }
                            else
                            {
                                selectionlist += "," + DBGrid.Rows[i].Cells["Id"].Value.ToString();
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < DBGrid.SelectedRows.Count; i++)
                    {
                        if (DBGrid.SelectedRows[i].Visible)
                        {
                            if (string.IsNullOrEmpty(selectionlist))
                            {
                                selectionlist = DBGrid.SelectedRows[i].Cells["Id"].Value.ToString();
                            }
                            else
                            {
                                selectionlist += "," + DBGrid.SelectedRows[i].Cells["Id"].Value.ToString();
                            }
                        }
                    }
                }
                EditPurchaseList frm = new EditPurchaseList();
                frm.ImportOrder(selectionlist);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frmMain frmmain = (frmMain)this.ParentForm;
                    if (frmmain.CheckChildFrmExist("OPA_PURCHASE_LIST") == true)
                    {
                        return;
                    }
                    OPA_PURCHASE_LIST newFrm = new OPA_PURCHASE_LIST();
                    if (newFrm != null && !frmmain.ShowMDIChild(newFrm, newFrm))
                    {
                        newFrm.Dispose();
                        newFrm = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
コード例 #5
0
        private void toolImport_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                frmSelectGrid   frmsel = new frmSelectGrid();
                frmSingleSelect frms   = new frmSingleSelect();
                frms.InitData("请选择导入方式:", "采购订单,客户订单,EXCEL", "采购订单", ComboBoxStyle.DropDownList);
                if (frms.ShowDialog() == DialogResult.OK)
                {
                    switch (Util.retValue1)
                    {
                    case "客户订单":
                        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)
                            {
                                EditPurchaseList frm = new EditPurchaseList();
                                frm.ImportOrder(frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;

                    case "采购订单":
                        dalVendorOrderList dalpo = new dalVendorOrderList();
                        BindingCollection <modVendorOrderList> listpo = dalpo.GetIList(false, string.Empty, string.Empty, string.Empty, DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listpo != null)
                        {
                            frmsel.InitViewList("请选择要导入的采购订单号:", listpo);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditPurchaseList frm = new EditPurchaseList();
                                frm.ImportPO(frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;

                    case "EXCEL":
                        OpenFileDialog ofd       = new OpenFileDialog();
                        string         inifolder = clsLxms.GetParameterValue("PURCHASE_IMPORT_PATH");
                        if (Directory.Exists(inifolder))
                        {
                            ofd.InitialDirectory = clsLxms.GetParameterValue("PURCHASE_IMPORT_PATH");
                        }
                        else
                        {
                            ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        }
                        ofd.Multiselect      = true;      //允许同时选择多个文件
                        ofd.Filter           = "Excel文件|*.xls;*.xlsx";
                        ofd.RestoreDirectory = true;
                        ofd.FilterIndex      = 1;
                        if (ofd.ShowDialog() == DialogResult.OK)
                        {
                            string[]         files = ofd.FileNames;
                            EditPurchaseList frm   = new EditPurchaseList();
                            frm.Import(files);
                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                LoadData();
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }