private void 另存为AToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem it in LvwFiles.SelectedItems) { if (it.Tag is string ver) { if (ver.EndsWith(Path.DirectorySeparatorChar.ToString())) { MessageBox.Show("您不能对文件夹执行此操作", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SfdSaveAs.FileName = it.Text; if (SfdSaveAs.ShowDialog() == DialogResult.OK) { try { Program.Repo.SaveAs(Program.Repo.RepositoryPath + ver, SfdSaveAs.FileName, true); } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); Program.WriteDebugLog("WARNING", ex); } } break; } } }
public void Import_Save() { var wb = new XLWorkbook(@"C:\Users\SAMED\source\repos\LibManagement\LibManagement\export\library.xlsx"); var ws = wb.Worksheet(1); ws.Cell(2, "C").Value = dtpStart.Value.ToString("dd/MM/yyyy") + " - " + dtpEnd.Value.ToString("dd/MM/yyyy"); int rowStart = 5; foreach (var item in _orderService.GetAllOrders()) { if (item.CreatedAt >= dtpStart.Value && item.CreatedAt <= dtpEnd.Value) { if (item.Status == true) { _status = "AÇIQ"; } else { _status = "TAMAMLANIB"; } ws.Cell(rowStart, 1).Value = rowStart - 4; ws.Cell(rowStart, 2).Value = item.customer.FullName; ws.Cell(rowStart, 3).Value = item.book.Name; ws.Cell(rowStart, 4).Value = item.CreatedAt.ToString("dd/MM/yyyy"); ws.Cell(rowStart, 5).Value = item.Deadline.ToString("dd/MM/yyyy"); ws.Cell(rowStart, 6).Value = item.TotalRentPrice.ToString("0.0") + " AZN"; ws.Cell(rowStart, 7).Value = item.FineForLate.ToString("0.0") + " AZN"; ws.Cell(rowStart, 8).Value = item.TotalPrice.ToString("0.0") + " AZN"; ws.Cell(rowStart, 9).Value = _status; ws.Cell(rowStart, 10).Value = item.user.FullName; rowStart++; } } ws.Cell(rowStart + 1, "B").Style.Fill.BackgroundColor = XLColor.Blue; ws.Cell(rowStart + 1, "B").Style.Font.FontSize = 14; ws.Cell(rowStart + 1, "B").Style.Font.FontColor = XLColor.White; ws.Cell(rowStart + 1, "B").Style.Font.Bold = true; ws.Cell(rowStart + 1, "B").Value = "CƏMİ SATIŞ: " + lblTotal.Text; ws.Cell(rowStart + 2, "B").Style.Fill.BackgroundColor = XLColor.Blue; ws.Cell(rowStart + 2, "B").Style.Font.FontSize = 14; ws.Cell(rowStart + 2, "B").Style.Font.FontColor = XLColor.White; ws.Cell(rowStart + 2, "B").Style.Font.Bold = true; ws.Cell(rowStart + 2, "B").Value = "KASSA: " + lblKassa.Text; SfdSaveAs.Title = "SATIŞLAR HAQQINDA MƏLUMAT"; SfdSaveAs.FileName = "REPORT" + dtpStart.Value.ToString("d.M.yyyy") + "to" + dtpEnd.Value.ToString("d.M.yyyy"); SfdSaveAs.DefaultExt = "xlsx"; DialogResult r = SfdSaveAs.ShowDialog(); if (r == DialogResult.OK) { wb.SaveAs(SfdSaveAs.FileName); } }
private void 另存为AToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem it in LvwFiles.SelectedItems) { if (it.Tag is Repository.RepoFile ver) { if (SfdSaveAs.ShowDialog() == DialogResult.OK) { Program.Repo.SaveAs(ver, SfdSaveAs.FileName, true); } break; } } }