private void simpleButton2_Click(object sender, EventArgs e) { folderKhachHang.ChonKhachHang chonKhachHang = new folderKhachHang.ChonKhachHang(); XtraDialogArgs args = new XtraDialogArgs(caption: "Caption", content: chonKhachHang, buttons: new DialogResult[] { DialogResult.OK, DialogResult.Cancel }); args.Showing += Args_Showing_ChonKH; args.Caption = "Default Text"; args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; switch (XtraDialog.Show(args)) { case DialogResult.OK: khachHang = chonKhachHang.LayKhachHangDaChon(); txtMaKH.EditValue = khachHang.MaKH; txtTenKH.EditValue = khachHang.TenKH; txtLoaiKH.EditValue = BUS.LoaiKhachHangBUS.LayLoaiKhachHang(khachHang).TenLoaiKH; txtSDT.EditValue = khachHang.SDT; txtDiemTichLuy.EditValue = khachHang.DiemTichLuy; HoaDonBUS.UpdateKhachHang(hoaDon.MaHoaDon, khachHang.MaKH); break; case DialogResult.Cancel: break; default: break; } }
private void RolesPie_barButtonItem_ItemClick(object sender, ItemClickEventArgs e) { try { RolesPorReporteUserControl configuracion = new RolesPorReporteUserControl(); if (XtraDialog.Show(configuracion, "Configurando Permisos de Edición", MessageBoxButtons.OKCancel) == DialogResult.OK) { var registros = AGlobalDataContext.ConfigurarPiePorRole; AGlobalDataContext.ConfigurarPiePorRole.DeleteAllOnSubmit(registros); AGlobalDataContext.SubmitChanges(); var nodos = configuracion.treeList1.GetAllCheckedNodes(); foreach (var nodo in nodos) { if (!nodo.HasChildren) { var reporteId = Convert.ToInt32(nodo.GetValue("Id")) / 1000; var roleId = Convert.ToInt32(nodo.GetValue("Id")) % 1000; AGlobalDataContext.ConfigurarPiePorRole.InsertOnSubmit(new ConfigurarPiePorRole { ReporteID = reporteId, RoleID = roleId }); AGlobalDataContext.SubmitChanges(); } } } } catch (Exception) { XtraMessageBox.Show("Error en la operacion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
//药品明细对话框 public static void CreateDrugEditControl(Drug d) { XtraDialogArgs xda = new XtraDialogArgs() { Caption = "药品明细框", Content = new DrugEditControl(d), Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel } }; xda.Showing += (s, e) => { e.Buttons[DialogResult.OK].Text = "保存"; e.Buttons[DialogResult.Cancel].Text = "取消"; e.Buttons[DialogResult.OK].Click += (x, y) => { DrugEditControl dec = xda.Content as DrugEditControl; Drug dd = dec.GetDrug(); int count = new DrugManager().Update(dd); if (count > 0) { XtraMessageBox.Show("更新成功", "信息提示"); } }; }; XtraDialog.Show(xda); }
public void Run() { if (XtraDialog.Show((XtraUserControl)_settingsForm, _settingsForm.FormName, _settingsForm.FormButtons) == System.Windows.Forms.DialogResult.OK) { _settingsForm.Execute(); } }
private void bntChonKH_Click(object sender, EventArgs e) { folderKhachHang.ChonKhachHang chonKhachHang = new folderKhachHang.ChonKhachHang(false); XtraDialogArgs args = new XtraDialogArgs(caption: "Caption", content: chonKhachHang, buttons: new DialogResult[] { DialogResult.OK, DialogResult.Cancel }); args.Showing += Args_Showing; args.Caption = "Default Text"; args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; switch (XtraDialog.Show(args)) { case DialogResult.OK: dataSource_KhachHang = KhachHangBUS.LayTatCaKhachHang_LoaiKhachHang(); txtKhachHang.Properties.DataSource = dataSource_KhachHang; khachHang = chonKhachHang.LayKhachHangDaChon(); txtKhachHang.EditValue = khachHang.MaKH; break; case DialogResult.Cancel: break; default: break; } }
public void ThemDichVu() { folderDichVu.ChonDichVu chonDichVu = new folderDichVu.ChonDichVu(true); XtraDialogArgs args = new XtraDialogArgs(caption: "Chọn dịch vụ", content: chonDichVu, buttons: new DialogResult[] { DialogResult.OK, DialogResult.Cancel }); args.Showing += Args_Showing; if (XtraDialog.Show(args) == DialogResult.OK) { foreach (int dichVu_Key in chonDichVu.GetSelectedDichVu().Keys) { if (DichVuBUS.LayThongTinDichVu(dichVu_Key).MaLoaiDV == 3) { listKhuyenMai.Add(-(listKhuyenMai.Count + 1), new DichVuPhongDTO(-(listKhuyenMai.Count + 1), thuePhong.MaThuePhong, dichVu_Key, DateTime.Now, chonDichVu.GetSelectedDichVu()[dichVu_Key], DichVuBUS.LayThongTinDichVu(dichVu_Key).DonGia)); } else { DichVuPhongBUS.LuuThongTinDichVuPhong(new DichVuPhongDTO(DichVuPhongBUS.PhatSinhMaDichVuPhong(), thuePhong.MaThuePhong, dichVu_Key, DateTime.Now, chonDichVu.GetSelectedDichVu()[dichVu_Key], DichVuBUS.LayThongTinDichVu(dichVu_Key).DonGia)); } //DichVuBUS.LayThongTinDichVu(dichVu_Key); } RefreshDataBindingDichVuPhong(); CalcTongTienAction(); } }
private void btnEditOffer_Click(object sender, EventArgs e) { try { if (FormHelper.IsGoodToGoOffer(labelDeviceId) == false) { return; } ColumnView view = gridControlOffers.MainView as ColumnView; int[] selectedRows = gridViewOffers.GetSelectedRows(); string offerId; if (selectedRows.Length > 0) { offerId = view.GetRowCellDisplayText(selectedRows[0], view.Columns["OfferId"]); OfferConfig offerConf = new OfferConfig(labelDeviceId.Text, int.Parse(offerId)); string statusDevice = labelDeviceId.Text; if (XtraDialog.Show(offerConf, $"Offer Configuration || { statusDevice}", MessageBoxButtons.OK) == DialogResult.OK) { FormHelper.LoadOffer(gridControlOffers, gridViewOffers); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void ShowExecutionPlan(DataTable tablePlan) { var control = new SQLiteExecutionPlanControl(); control.InitializeCommand(tablePlan); XtraDialog.Show(_Owner, control, "Execution plan", MessageBoxButtons.OK); }
public static void EditObject(IWin32Window owner, object value) { using var editor = new PropertyGridEx() { SelectedObject = value }; XtraDialog.Show(owner, editor, "Edit object", MessageBoxButtons.OK); }
public void InPhieuDat() { reportPhieudatphong = new PhieuDatPhong(); reportPhieudatphong.BindingData(datPhong, khachHang); XtraDialogArgs phieudatphong = new XtraDialogArgs(caption: "Phiếu đặt phòng", content: new ReportViewer(reportPhieudatphong), buttons: new DialogResult[] { DialogResult.OK }); XtraDialog.Show(phieudatphong); }
private void AbrirControlCuenta(string nombreSocio, EntidadCUENTA miEntidad, bool nuevoRegistro) { /************************* * CREAMOS EL CONTROL *************************/ Controles.ControlCuenta miControl = new Controles.ControlCuenta(); XtraDialogArgs miDialogo = new XtraDialogArgs(); miDialogo.Showing += Args_Showing; miDialogo.Content = miControl; miDialogo.Caption = "ESTABLECER CUENTA BANCARIA"; miDialogo.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; /********************************** * SI HAY ESTABLECEMOS PROPIEDADES * ********************************/ miControl.entidadCUENTABindingSource.DataSource = miEntidad; miControl.txtSocio.Text = nombreSocio; /************************************* * MOSTRAMOS EL DIALOGO EN PANTALLA * ***********************************/ DialogResult miResultado = XtraDialog.Show(miDialogo); /*************************************** * AL CERRARSE VERIFICAMOS EL BOTON OK * *************************************/ if (miResultado == DialogResult.OK) { miEntidad = (EntidadCUENTA)miControl.entidadCUENTABindingSource.Current; /********************************************************** * VERIFICAMOS LOS CAMPOS LLENADOS DE FORMA OBLIGATORIA * ********************************************************/ if (verificaCamposObligatoriosMiControlCuenta(miEntidad)) { if (nuevoRegistro) { dbContext.CUENTA.Add(miEntidad); } else { var temp = dbContext.CUENTA.Find(miEntidad.IdCuenta); dbContext.Entry(temp).CurrentValues.SetValues(miEntidad); } dbContext.SaveChanges(); Mensajes.MensajeRapido("DATOS DE LA CUENTA GUARDADO CORRECTAMENTE"); } else { Mensajes.MensajeSimple("Falta información", this.mensajeError, MessageBoxIcon.Stop); } } }
public static DirectoryInfo SelectProjectFolder(IWin32Window owner) { var browser = new ProjectBrowser(); if (XtraDialog.Show(owner, browser, "Browser") != DialogResult.OK) { return(null); } return(browser.SelectedFolder); }
private void BtnVerPlanPagosNuevaVentana_Click(object sender, EventArgs e) { Controles.ControlPlanCuentas miControl = new ControlPlanCuentas(); miControl.pLANCUENTASBindingSource.DataSource = miListaPlanCuentas; XtraDialogArgs miDialogo = new XtraDialogArgs(); miDialogo.Showing += this.Args_ShowingSimple; miDialogo.Content = miControl; miDialogo.Caption = "PLAN DE CUENTAS"; miDialogo.Buttons = new DialogResult[] { DialogResult.OK }; DialogResult miResultado = XtraDialog.Show(miDialogo); }
public void GenerateDownloadLink(ChangeLogViewer clv = null) { if (clv == null) { return; } if (XtraDialog.Show(clv, "New Update " + apis.Data.SRFVersion, MessageBoxButtons.YesNo) == DialogResult.Yes) { System.Diagnostics.Process.Start(apis.Data.SRFDownloadLink); } }
ScatterChartConstantLineUserData GetConstantLineModuleData(ScatterChartDashboardItem dashboardItem) { var data = GetDataFromString(dashboardItem.CustomProperties.GetValue(PropertyName)); using (ValueSelectorControl selector = new ValueSelectorControl(data)) { if (XtraDialog.Show(selector, "Adjust constant lines") == DialogResult.OK) { return(selector.ConstantLineModuleData); } } return(null); }
private void BtnNuevaPersona_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { /************************* * CREAMOS EL CONTROL *************************/ Controles.ControlPersona miControl = new Controles.ControlPersona(); XtraDialogArgs miDialogo = new XtraDialogArgs(); miDialogo.Showing += Args_Showing; miDialogo.Content = miControl; miDialogo.Caption = "Nuevo personal de la Empresa"; miDialogo.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; /********************************** * SI HAY ESTABLECEMOS PROPIEDADES * ********************************/ miControl.pERSONABindingSource.DataSource = miEntidad; /************************************* * MOSTRAMOS EL DIALOGO EN PANTALLA * ***********************************/ DialogResult miResultado = XtraDialog.Show(miDialogo); /*************************************** * AL CERRARSE VERIFICAMOS EL BOTON OK * *************************************/ if (miResultado == DialogResult.OK) { miEntidad = (EntidadPERSONA)miControl.pERSONABindingSource.Current; /********************************************************** * VERIFICAMOS LOS CAMPOS LLENADOS DE FORMA OBLIGATORIA * ********************************************************/ if (verificaCamposObligatoriosMiControl(miEntidad)) { //miEntidad.fecha_reg = DateTime.Now; //miEntidad.id_usuario = NPermisos.IdUsuario; dbContext.PERSONA.Add(miEntidad); dbContext.SaveChanges(); miEntidad = new EntidadPERSONA(); } else { Mensajes.MensajeSimple("Falta información", this.mensajeError, MessageBoxIcon.Stop); } //Mensajes.MensajeRapido(miEntidad.apellidos + " " + miEntidad.id_usuario); } }
private void VerificaNomencladoresPrincipales() { List <string> errores = new List <string>(); if (!AGlobalDataContext.Municipio.Any()) { errores.Add("-No están definidos los municipios"); } if (!AGlobalDataContext.NomencladorCargo.Any()) { errores.Add("-Nomenclador de cargos vacio"); } if (!AGlobalDataContext.Agrupacion.Any()) { errores.Add("-No existe agrupación creada aún"); } if (!AGlobalDataContext.Paises.Any()) { errores.Add("-Nomenclador de Paises vacio"); } if (!AGlobalDataContext.Provincia.Any()) { errores.Add("-Nomenclador de Provincias vacio"); } if (!AGlobalDataContext.TipoMoneda.Any()) { errores.Add("-No existen Monedas definidas aún"); } if (!AGlobalDataContext.ResponsabilidadEmpresario.Any()) { errores.Add("-No existen Responsabilidades de empresarios definidos aún"); } if (!AGlobalDataContext.ControlClientes.Any()) { errores.Add("-No existen contrato insertado en el sistema aún"); } RichTextBox text = new RichTextBox { Height = 56, Lines = errores.ToArray(), Dock = DockStyle.Fill }; if (errores.Any()) { XtraDialog.Show(text, "Nomencladores sin definir", MessageBoxButtons.OK); } }
// TODO: No Override. public void GenerateDownloadLink(ChangeLogViewer clv = null, Root serverData = null) { if (serverData == null) { serverData = apis.Data; } if (clv == null) { new ChangeLogViewer(serverData.SRFChangelog); } if (XtraDialog.Show(clv, "New Update " + serverData.SRFVersion, MessageBoxButtons.YesNo) == DialogResult.Yes) { System.Diagnostics.Process.Start(serverData.SRFDownloadLink); } }
//搜索药品对话框 public static void CreateSearchControl(ButtonEdit be) { XtraDialogArgs xda = new XtraDialogArgs() { Caption = "药品搜索框", Content = new SearchControl(be), // Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel } }; xda.Showing += (s, e) => { e.Buttons[DialogResult.OK].Text = "确定"; e.Buttons[DialogResult.OK].Click += (x, y) => { SearchControl sc = xda.Content as SearchControl; }; }; XtraDialog.Show(xda); }
//配置对话框 public static void CreateConfigControl() { XtraDialogArgs xda = new XtraDialogArgs() { Caption = "常用配置", Content = new ConfigControl(), Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel } }; xda.Showing += (s, e) => { e.Buttons[DialogResult.OK].Text = "确定"; e.Buttons[DialogResult.OK].Click += (x, y) => { (xda.Content as ConfigControl).Reset(); }; }; XtraDialog.Show(xda); }
public void ShowExecutionPlan(DataTable tablePlan) { var control = new GridViewer(); control.AttachDataSource(tablePlan); var colRows = control.Columns["rows"]; if (colRows != null) { var ruleRows = control.FormatRules.AddDataBar(colRows); (ruleRows.Rule as FormatConditionRuleDataBar).PredefinedName = "Blue Gradient"; } var colFiltered = control.Columns["filtered"]; if (colFiltered != null) { var ruleFiltered = control.FormatRules.AddDataBar(colFiltered); (ruleFiltered.Rule as FormatConditionRuleDataBar).PredefinedName = "Blue Gradient"; } var colExtra = control.Columns["Extra"]; if (colExtra != null) { control.Columns.Remove(colExtra); } control.ColumnAutoWidth = true; control.PreviewFieldName = "Extra"; control.Load += (s, e) => { var ctrl = s as Control; if (ctrl.Parent is XtraDialogForm frm) { frm.MakeXtraDialogFormResizeableWithDelay(); } }; XtraDialog.Show(_Owner, control, "Execution plan", MessageBoxButtons.OK); }
private void btnAddOffer_Click(object sender, EventArgs e) { try { OfferConfig offerConf = new OfferConfig(labelDeviceId.Text); if (FormHelper.IsGoodToGoOffer(labelDeviceId) == false) { return; } string statusDevice = labelDeviceId.Text; if (XtraDialog.Show(offerConf, $"Offer Configuration || { statusDevice}", MessageBoxButtons.OK) == DialogResult.OK) { FormHelper.LoadOffer(gridControlOffers, gridViewOffers); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//缴款单弹出对话框 public static void CreateJKDControl(Account account) { XtraDialogArgs xda = new XtraDialogArgs() { Caption = "缴款单明细", Content = new JKDControl1(account), Buttons = new DialogResult[] { DialogResult.Cancel, DialogResult.OK }, }; xda.Showing += (s, e) => { e.Buttons[DialogResult.OK].Text = "保存"; e.Buttons[DialogResult.Cancel].Text = "取消"; e.Buttons[DialogResult.OK].Click += (x, y) => { MessageBox.Show("none"); }; }; XtraDialog.Show(xda); }
public SpreadDataSourceData SelectSpreadsheetTables(string fileName) { var control = new SpreadsheetTableSelectorControl(fileName); var dlgResult = XtraDialog.Show(_Owner, control, "Table selected", MessageBoxButtons.OK); if (dlgResult != DialogResult.OK) { return(null); } var result = new SpreadDataSourceData() { FileName = fileName, Worksheet = control.SelectedTable?.SheetName, TableName = control.SelectedTable?.TableName, TableRange = control.SelectedTable?.Range }; return(result); }
private void SolicitudDinero_barButtonItem_ItemClick(object sender, ItemClickEventArgs e) { var Popup = new PopupFechaMonedaXtraUserControl(); if (XtraDialog.Show(Popup, "Seleccione Fecha y Moneda", MessageBoxButtons.OKCancel) == DialogResult.OK) { while (!Popup.ValidateForm()) { XtraMessageBox.Show("Entrada de datos incorrecta, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Popup.Dispose(); Popup = new PopupFechaMonedaXtraUserControl(); XtraDialog.Show(Popup, "Seleccione Fecha y Moneda", MessageBoxButtons.OKCancel); } var reporte = new SolicitudDineroXtraReport(Popup.FechaInicial, Popup.FechaFinal, Popup.MonedaId); Popup.Dispose(); reporte.CreateDocument(); // reporte.ShowPreviewDialog(); reporte.ShowRibbonPreviewDialog(); } }
private void SetEstadoProyecto(Enumerados.EstadoProyecto estadoProyecto) { var proyecto = GetSelectedProyecto(); if (proyecto == null) { return; } PopupSetEstados_XtraUserControlcs popup = new PopupSetEstados_XtraUserControlcs(); popup.Estado_lookUpEdit.Properties.DataSource = Enumerados.ListaDeEnumerados(typeof(Enumerados.EstadoProyecto)); if (XtraDialog.Show(popup) == DialogResult.OK) { AGlobalDataContext = new NegocioDataContext(); proyecto = AGlobalDataContext.Proyectos.FirstOrDefault(c => c.ProyectoID == proyecto.ProyectoID); proyecto.EstadoProyecto = (int)estadoProyecto; AGlobalDataContext.SubmitChanges(); PopulaProyectos(); } }
private void btnThayDoiKhachHang_Click(object sender, EventArgs e) { folderKhachHang.ChonKhachHang chonKhachHang = new folderKhachHang.ChonKhachHang(false); XtraDialogArgs args = new XtraDialogArgs(caption: "Caption", content: chonKhachHang, buttons: new DialogResult[] { DialogResult.OK, DialogResult.Cancel }); args.Showing += Args_Showing_ChonKH; args.Caption = "Default Text"; args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; switch (XtraDialog.Show(args)) { case DialogResult.OK: khachHang = chonKhachHang.LayKhachHangDaChon(); txtMaKH.EditValue = khachHang.MaKH; txtLoaiKH.EditValue = LoaiKhachHangBUS.LayLoaiKhachHang(khachHang.MaLoaiKH).TenLoaiKH; txtEmail.EditValue = khachHang.Email; txtSDT.EditValue = khachHang.SDT; txtTenKH.EditValue = khachHang.TenKH; txtDiaChi.EditValue = khachHang.DiaChi; txtNgaySinh.EditValue = khachHang.NgaySinh; DatPhongBUS.UpdateKhachHang(datPhong.MaDatPhong, khachHang.MaKH); break; case DialogResult.Cancel: break; default: break; } }
internal void MostrarListaDeErroresDialogo(List <string> listaErrores) { XtraDialog.Show(new LoginUserControl(listaErrores), "Lista de Errores", MessageBoxButtons.OK); }
private void wbntQuanlyphong_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e) { switch (e.Button.Properties.Tag.ToString()) { case "Thêm Dịch Vụ": folderDichVu.ChonDichVu chonDichVu = new folderDichVu.ChonDichVu(false); XtraDialogArgs args = new XtraDialogArgs(caption: "Chọn dịch vụ", content: chonDichVu, buttons: new DialogResult[] { DialogResult.OK, DialogResult.Cancel }); args.Showing += Args_Showing; if (XtraDialog.Show(args) == DialogResult.OK) { foreach (int dichVu_Key in chonDichVu.GetSelectedDichVu().Keys) { DichVuPhongBUS.LuuThongTinDichVuPhong(new DichVuPhongDTO(DichVuPhongBUS.PhatSinhMaDichVuPhong(), thuePhong.MaThuePhong, dichVu_Key, DateTime.Now, chonDichVu.GetSelectedDichVu()[dichVu_Key], DichVuBUS.LayThongTinDichVu(dichVu_Key).DonGia)); //DichVuBUS.LayThongTinDichVu(dichVu_Key); } RefreshDataBindingDichVuPhong(); } break; case "Chuyển Phòng": ChuyenPhong formChuyenPhong = new ChuyenPhong(thuePhong); if (FlyoutDialog.Show(this.FindForm(), formChuyenPhong) == DialogResult.OK) { OnThueThemPhongSuccess(); } break; case "Xóa Dịch Vụ": if (XtraMessageBox.Show("Bạn có chắc muốn xóa dịch vụ '" + dichVuPhong.Rows[gridView1.GetFocusedDataSourceRowIndex()]["TenDV"] + "' ?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { DichVuPhongBUS.XoaDichVuPhong((int)dichVuPhong.Rows[gridView1.GetFocusedDataSourceRowIndex()]["MaDVP"]); RefreshDataBindingDichVuPhong(); } break; case "Hủy Phòng": //Thông báo xác nhận if (XtraMessageBox.Show("Bạn có chắc hủy thuê phòng này ?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.No) { return; } ThuePhongBUS.XoaCacDichVuPhong(thuePhong); ThuePhongBUS.XoaThuePhong(thuePhong); PhongBUS.CapNhatTinhTrangPhong(thuePhong.MaPhong, 0); if (HoaDonBUS.DemSoLuongThuePhong(hoaDon.MaHoaDon) == 0) { HoaDonBUS.XoaHoaDon(hoaDon); } ((ThongTinChiTietNhieuPhong)Parent.Parent.Parent).OnXoaPhong(); break; case "Trả Phòng": //Đếm số lượng phòng đã trả trong hóa đơn / Nếu hóa đơn còn 1 phòng chuyển qua thanh toán if (HoaDonBUS.DemSoLuongPhongDangConDuocThueHienTai(hoaDon) == 1) { XtraMessageBox.Show("Hóa đơn chỉ còn lại 1 phòng! Vui lòng thanh toán", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //Xác nhận trả phòng if (XtraMessageBox.Show("Bạn có chắc trả phòng này ?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.No) { return; } ThuePhongBUS.CapNhatThongTinThuePhong(new ThuePhongDTO(thuePhong.MaThuePhong, thuePhong.MaPhong, thuePhong.GioThuePhong, DateTime.Now, thuePhong.MaHoaDon, Double.NaN)); switch (PhongBUS.LayThongTinPhong(thuePhong.MaPhong).MaTinhTrangPhong) { case 1: if (ThamSoBUS.LayChuyenSangChoDonDepSauKhiThanhToan()) { PhongBUS.CapNhatTinhTrangPhong(thuePhong.MaPhong, 5); } else { PhongBUS.CapNhatTinhTrangPhong(thuePhong.MaPhong, 0); } break; case 7: if (ThamSoBUS.LayChuyenSangChoDonDepSauKhiThanhToan()) { PhongBUS.CapNhatTinhTrangPhong(thuePhong.MaPhong, 6); } else { PhongBUS.CapNhatTinhTrangPhong(thuePhong.MaPhong, 4); } break; } //Thông báo thành công XtraMessageBox.Show("Trả phòng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshDataBinding(phong, ThuePhongBUS.LayThongTinThuePhong(thuePhong.MaThuePhong)); break; case "Thanh Toán": goToThanhToan(thuePhong); break; case "Thông tin đặt phòng": (this.ParentForm as MainForm).HienThiThongTinDatPhong(HoaDonBUS.LayThongTinHoaDon(thuePhong.MaHoaDon).MaDatPhong); break; case "Tách Hóa Đơn": if (HoaDonBUS.LayTatCaCacThuePhong(hoaDon.MaHoaDon).Count == 1) { XtraMessageBox.Show("Hóa đơn chỉ có 1 phòng nên không thể tách!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FlyoutDialog.Show(this.FindForm(), new TachHoaDon(hoaDon, OnThueThemPhongSuccess)); break; case "Thuê Thêm Phòng": FlyoutDialog.Show(this.FindForm(), new ThemPhongVaoHoaDon(hoaDon, OnThueThemPhongSuccess)); break; } }
public override void Save() { gridView1.UpdateCurrentRow(); var db = new DAL.dbDataContext(); if (invoice.ID == 0) { db.InvoiceHeaders.InsertOnSubmit(invoice); } else { db.InvoiceHeaders.Attach(invoice); } SetData(); var items = (Collection <DAL.InvoiceDetail>)gridView1.DataSource; if (invoice.Expences > 0) { var totalPrice = items.Sum(x => x.TotalPrice); var totalQTY = items.Sum(x => x.ItemQty); var ByPriceUnit = invoice.Expences / totalPrice; // السعر لكل جنيه واحد var ByQtyUnit = invoice.Expences / totalQTY; //السعر لكل قطعه واحده من الوحده المختاره XtraDialogArgs args = new XtraDialogArgs(); UserControls.CostDistributionOption distributionOption = new UserControls.CostDistributionOption(); args.Caption = ""; args.Content = distributionOption; ((XtraBaseArgs)args).Buttons = new DialogResult[] { DialogResult.OK }; args.Showing += Args_Showing; XtraDialog.Show(args); foreach (var row in items) { if (distributionOption.SelectedOption == Master.CostDistributionOptions.ByPrice) { row.CostValue = (row.TotalPrice / row.ItemQty) + (ByPriceUnit * row.Price); // توزيع بالسعر } else { row.CostValue = (row.TotalPrice / row.ItemQty) + (ByQtyUnit); // توزيع بالكميه } row.TotalCostValue = row.ItemQty * row.CostValue; } } else { foreach (var row in items) { row.CostValue = row.TotalPrice / row.ItemQty; row.TotalCostValue = row.TotalPrice; } } var msg = $" {invoice.ID} لعميل {glkp_PartID.Text} فاتوره مبيعات رقم "; #region Journals // فاتوره بقيمه بضاعه 1000 // ضريبه 120 // مصروف نقل 100 // خصم 50 // 1170 الصافي // حساب المخزون - مدين - 1100 // حساب ضريبه مضافه - مدين - 120 // حساب المورد - دائن - 1220 // حساب المورد - مدين - 50 // حساب خصم نقدي مكتسب - دائن - 50 // حساب المورد -مدين - 1000 // حساب الخذنه -دائن - 1000 db.Journals.DeleteAllOnSubmit(db.Journals.Where(x => x.SourceType == (byte)type && x.SourceID == invoice.ID)); db.SubmitChanges(); var partAccountID = db.CustomersAndVendors.Single(x => x.ID == invoice.PartID).AccountID; var store = db.Stores.Single(x => x.ID == invoice.Branch); var drawer = db.Drawers.Single(x => x.ID == invoice.Drawer); db.Journals.InsertOnSubmit(new DAL.Journal() // Part { AccountID = partAccountID, Code = 54545, Credit = invoice.Total + invoice.TaxValue + invoice.Expences, Debit = 0, InsertDate = invoice.Date, Notes = msg, SourceID = invoice.ID, SourceType = (byte)type, }); db.Journals.InsertOnSubmit(new DAL.Journal() // Store Inventory { AccountID = store.InventoryAccountID, Code = 54545, Credit = 0, Debit = invoice.Total + invoice.Expences, InsertDate = invoice.Date, Notes = msg, SourceID = invoice.ID, SourceType = (byte)type, }); if (invoice.Tax > 0) { db.Journals.InsertOnSubmit(new DAL.Journal() // { AccountID = Session.Defaults.PurchaseTax, Code = 54545, Credit = 0, Debit = invoice.TaxValue, InsertDate = invoice.Date, Notes = msg + " - ضريبه مضافه ", SourceID = invoice.ID, SourceType = (byte)type, }); } //if (Invoice.Expences > 0) // db.Journals.InsertOnSubmit(new DAL.Journal() // // { // AccountID = Session.Defualts.PurchaseExpences, // Code = 54545, // Credit = 0, // Debit = Invoice.Expences, // InsertDate = Invoice.Date, // Notes = msg + " - مصروفات شراء", // SourceID = Invoice.ID, // SourceType = (byte)Type, // }); if (invoice.DiscountVale > 0) { db.Journals.InsertOnSubmit(new DAL.Journal() // Store Tax { AccountID = Session.Defaults.DiscountReceivedAccount, Code = 54545, Credit = invoice.DiscountVale, Debit = 0, InsertDate = invoice.Date, Notes = msg + " - خصم شراء", SourceID = invoice.ID, SourceType = (byte)type, }); db.Journals.InsertOnSubmit(new DAL.Journal() // Store Tax { AccountID = partAccountID, Code = 54545, Credit = 0, Debit = invoice.DiscountVale, InsertDate = invoice.Date, Notes = msg + " - خصم شراء", SourceID = invoice.ID, SourceType = (byte)type, }); } if (invoice.Paid > 0) { db.Journals.InsertOnSubmit(new DAL.Journal() // { AccountID = drawer.AccountID, Code = 54545, Credit = invoice.Paid, Debit = 0, InsertDate = invoice.Date, Notes = msg + " - سداد", SourceID = invoice.ID, SourceType = (byte)type, }); db.Journals.InsertOnSubmit(new DAL.Journal() // { AccountID = partAccountID, Code = 54545, Credit = 0, Debit = invoice.Paid, InsertDate = invoice.Date, Notes = msg + " - سداد", SourceID = invoice.ID, SourceType = (byte)type, }); } #endregion foreach (var row in items) { row.InvoiceID = invoice.ID; } generalDB.SubmitChanges(); db.StoreLogs.DeleteAllOnSubmit(db.StoreLogs.Where(x => x.SourceType == (byte)type && x.SourceID == invoice.ID)); db.SubmitChanges(); if (invoice.PostedToStore) { foreach (var row in items) { var unitView = Session.ProductsView.Single(x => x.ID == row.ItemID).Units.Single(x => x.UnitID == row.ItemUnitID); db.StoreLogs.InsertOnSubmit(new DAL.StoreLog() { ProductID = row.ItemID, InsertTime = invoice.PostDate.Value, SourceID = invoice.ID, SourceType = (byte)type, Notes = msg, IsInTransaction = true, StoreID = row.StoreID, Qty = row.ItemQty * unitView.Factor, CostValue = row.CostValue / unitView.Factor }); } } db.SubmitChanges(); base.Save(); }