public DataTable D_Shipping_Select(D_Shipping_Entity dshe, D_ShippingDetails_Entity dsde, D_Instruction_Entity die) { Dictionary <string, ValuePair> dic = new Dictionary <string, ValuePair> { { "@SoukoCD", new ValuePair { value1 = SqlDbType.NVarChar, value2 = dshe.SoukoCD } }, { "@ShippingStartDate", new ValuePair { value1 = SqlDbType.Date, value2 = dshe.ShippingDateFrom.Replace("/", "-") } }, { "@ShippingEndDate", new ValuePair { value1 = SqlDbType.Date, value2 = dshe.ShippingDateTo.Replace("/", "-") } }, { "@Number", new ValuePair { value1 = SqlDbType.VarChar, value2 = dsde.Number } }, { "@DeliverySoukoCD", new ValuePair { value1 = SqlDbType.NVarChar, value2 = die.DeliverySoukoCD } }, { "@CarrierCD", new ValuePair { value1 = SqlDbType.NVarChar, value2 = dshe.CarrierCD } }, { "@ITEMCD", new ValuePair { value1 = SqlDbType.VarChar, value2 = dsde.ItemCD } }, { "@JanCD", new ValuePair { value1 = SqlDbType.VarChar, value2 = dsde.JanCD } }, { "@SKUCD", new ValuePair { value1 = SqlDbType.VarChar, value2 = dsde.SKUCD } }, { "@ShippingKBN", new ValuePair { value1 = SqlDbType.TinyInt, value2 = dshe.ShippingKBN } }, { "@InvoiceNO", new ValuePair { value1 = SqlDbType.TinyInt, value2 = dshe.InvoiceNO } }, }; UseTransaction = true; return(SelectData(dic, "D_Shipping_Select")); }
public void F11() { if (ErrorCheck()) { mshe = new D_Shipping_Entity { SoukoCD = cboWarehouse.SelectedValue.ToString(), ShippingDateFrom = txtShippingStartDate.Text, ShippingDateTo = txtShippingEndDate.Text, CarrierCD = cboShipping.SelectedValue.ToString(), ShippingKBN = CheckValue1(), InvoiceNO = CheckValue2(), }; dsde = new D_ShippingDetails_Entity { Number = SC_Order.TxtCode.Text, SKUCD = Sc_SKUCD.TxtCode.Text, JanCD = SC_JanCD.TxtCode.Text, ItemCD = Sc_Item.TxtCode.Text, }; die = new D_Instruction_Entity { DeliverySoukoCD = cboDestinationWarehouse.SelectedValue.ToString(), }; dtSearch = skskbl.D_Shipping_Select(mshe, dsde, die); if (dtSearch.Rows.Count == 0) { skskbl.ShowMessage("E128"); cboWarehouse.Focus(); } else { dgvShukkaShoukai.DataSource = dtSearch; } } }
public DataTable D_Shipping_Select(D_Shipping_Entity dhse, D_ShippingDetails_Entity dsde, D_Instruction_Entity die) { return(dsdl.D_Shipping_Select(dhse, dsde, die)); }
/// <summary> /// to export Excel File /// </summary> private void F10() { if (ErrorCheck()) { mshe = new D_Shipping_Entity { SoukoCD = cboWarehouse.SelectedValue.ToString(), ShippingDateFrom = txtShippingStartDate.Text, ShippingDateTo = txtShippingEndDate.Text, CarrierCD = cboShipping.SelectedValue.ToString(), ShippingKBN = CheckValue1(), InvoiceNO = CheckValue2(), }; dsde = new D_ShippingDetails_Entity { Number = SC_Order.TxtCode.Text, SKUCD = Sc_SKUCD.TxtCode.Text, JanCD = SC_JanCD.TxtCode.Text, ItemCD = Sc_Item.TxtCode.Text, }; die = new D_Instruction_Entity { DeliverySoukoCD = cboDestinationWarehouse.SelectedValue.ToString(), }; dtSearch = skskbl.D_Shipping_Select(mshe, dsde, die); if (dtSearch.Rows.Count > 0) { DataTable dtExport = dtSearch; dtExport = ChangeDataColumnName(dtExport); SaveFileDialog savedialog = new SaveFileDialog(); savedialog.Filter = "Excel Files|*.xlsx;"; savedialog.Title = "Save"; savedialog.FileName = "ExportFile"; savedialog.InitialDirectory = @"C:\"; savedialog.RestoreDirectory = true; if (savedialog.ShowDialog() == DialogResult.OK) { if (Path.GetExtension(savedialog.FileName).Contains(".xlsx")) { Microsoft.Office.Interop.Excel._Application excel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel._Workbook workbook = excel.Workbooks.Add(Type.Missing); Microsoft.Office.Interop.Excel._Worksheet worksheet = null; worksheet = workbook.ActiveSheet; worksheet.Name = "ExportedFromDatGrid"; using (XLWorkbook wb = new XLWorkbook()) { wb.Worksheets.Add(dtExport, "test"); wb.SaveAs(savedialog.FileName); skskbl.ShowMessage("I203", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); //Export Successful } } Clear(); dgvShukkaShoukai.DataSource = string.Empty; cboWarehouse.Focus(); } } } }