public void Fechas() { XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "Fecha"; args.Prompt = "Seleccione Fecha"; args.DefaultButtonIndex = 0; //args.Showing += Args_Showing; // initialize a DateEdit editor with custom settings DateEdit editor = new DateEdit(); editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.TouchUI; editor.Properties.Mask.EditMask = "MMMM d, yyyy"; args.Editor = editor; // a default DateEdit value args.DefaultResponse = DateTime.Now.Date.AddDays(3); // display an Input Box with the custom editor try { var result = XtraInputBox.Show(args).ToString(); //gCVenta.DataSource = facturas.Where(x => x.Fecha.Value.ToString("MM/dd/yyyy") == Convert.ToDateTime(result).ToString("MM/dd/yyyy")); } catch (Exception) { } }
private void itemChuyenBan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (gvBan.GetFocusedRowCellValue("ID") == null) { XtraMessageBox.Show("Hãy chọn [Bàn] cần chuyển.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (gvBan.GetFocusedRowCellValue("HDID") == null) { XtraMessageBox.Show("Bàn đang trống, không thể thực hiện chức năng này.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "CHUYỂN BÀN"; args.Prompt = "Chọn bàn chuyển tới"; args.DefaultButtonIndex = 0; // LookUpEdit lookBan = new LookUpEdit(); lookBan.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "Tên bàn", 300)); lookBan.Properties.ShowFooter = lookBan.Properties.ShowHeader = lookBan.Properties.ShowLines = false; lookBan.Properties.DataSource = db.BANs.Select(p => new { Name = p.Name + p.Number, p.ID }); lookBan.Properties.DisplayMember = "Name"; lookBan.Properties.ValueMember = "ID"; // args.Editor = lookBan; args.DefaultResponse = (int)gvBan.GetFocusedRowCellValue("ID"); var result = XtraInputBox.Show(args).ToString(); db.Update_HD2((int)gvBan.GetFocusedRowCellValue("HDID"), int.Parse(result.ToString()), (int)gvBan.GetFocusedRowCellValue("ID")); LoadData(); } catch { } }
private string GetMessageBoxText(string caption, string label) { XtraInputBoxArgs args = new XtraInputBoxArgs(this, label, caption, string.Empty); var result = XtraInputBox.Show(args); return((string)result); }
private void TitleLabel_Click_1(object sender, EventArgs e) { XtraInputBoxArgs args = new XtraInputBoxArgs(); args.Caption = "Месяц табеля"; args.Prompt = "Табель за месяц"; args.DefaultButtonIndex = 0; args.Showing += Args_Showing; DateEdit editor = new DateEdit(); editor.Properties.MaxValue = DateTime.Now; editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.TouchUI; editor.Properties.Mask.EditMask = "MMMM yyyy"; args.Editor = editor; args.DefaultResponse = DateTime.Now.Date; var result = XtraInputBox.Show(args); if (result == null) { return; } searchdate = DateTime.Parse(result.ToString()); ClearForm(); GenerateForm(); }
private void btnPruebaCorreo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "Ingrese EMail Destino"; args.Prompt = "Direccion de Correo"; args.DefaultButtonIndex = 0; //args.Showing += Args_Showing; // initialize a DateEdit editor with custom settings TextEdit editor = new TextEdit(); args.Editor = editor; // a default DateEdit value args.DefaultResponse = "Correo Destino"; // display an Input Box with the custom editor string result = string.Empty; result = XtraInputBox.Show(args).ToString(); if (result != string.Empty) { CLS_Email Envio = new CLS_Email(); Envio.EmailDestino = result; Envio.SendMailPrueba(); } }
private void btnUpPDF_Click(object sender, EventArgs e) { OpenDialog.Filter = "Portable Document Format (*.PDF)|*.PDF"; OpenDialog.FilterIndex = 1; OpenDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);; OpenDialog.Title = "Cargar Documento PDF"; OpenDialog.CheckFileExists = false; OpenDialog.Multiselect = false; DialogResult result = OpenDialog.ShowDialog(); if (result == DialogResult.OK) { TextEdit textEdit = new TextEdit(); textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Regular; textEdit.Properties.MaxLength = 100; //textEdit.Properties.Mask.EditMask = "f0"; //textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask. XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "Ingrese el nombre del Archivo"; args.Prompt = "Descripción"; args.DefaultButtonIndex = 0; //args.Showing += Args_Showing; // initialize a DateEdit editor with custom settings TextEdit editor = new TextEdit(); args.Editor = editor; // a default DateEdit value args.DefaultResponse = "Archivo PDF"; // display an Input Box with the custom editor args.Editor = textEdit; var result2 = XtraInputBox.Show(args).ToString(); if (result2 != null) { txtNombreArchivoPDF.Text = result2; string ar = OpenDialog.FileName; FileStream fs = new FileStream(ar, FileMode.Open); //Creamos un array de bytes para almacenar los datos leídos por fs. Byte[] Archivo = new byte[fs.Length]; //Y guardamos los datos en el array data fs.Read(Archivo, 0, Convert.ToInt32(fs.Length)); CLS_Activos udp = new CLS_Activos(); udp.Id_Activo = vId_Activo; udp.Opcion = 1; udp.NombreArchivoPDF = txtNombreArchivoPDF.Text; udp.ArchivoPDF = Archivo; udp.MtdUpdateActivoArchivoPDF(); if (udp.Exito) { XtraMessageBox.Show("Se a agregado el PDF con Exito"); } else { XtraMessageBox.Show(udp.Mensaje); } } } }
private void btnAgregar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenDialog.Filter = "Formato de imagen PNG (*.png)|*.png |Formato de imagen JPEG (*.jpg)|*.jpg|La extensión de imagen .gif (*.gif)|*.gif"; OpenDialog.FilterIndex = 1; OpenDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);; OpenDialog.Title = "Cargar Imagenes"; OpenDialog.CheckFileExists = false; OpenDialog.Multiselect = false; DialogResult result = OpenDialog.ShowDialog(); if (result == DialogResult.OK) { TextEdit textEdit = new TextEdit(); textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Regular; textEdit.Properties.MaxLength = 100; //textEdit.Properties.Mask.EditMask = "f0"; //textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask. XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "Ingrese la descripcion de la imagen"; args.Prompt = "Descripción"; args.DefaultButtonIndex = 0; //args.Showing += Args_Showing; // initialize a DateEdit editor with custom settings TextEdit editor = new TextEdit(); args.Editor = editor; // a default DateEdit value args.DefaultResponse = "Descripcion de la Imagen"; // display an Input Box with the custom editor args.Editor = textEdit; var result2 = XtraInputBox.Show(args).ToString(); if (result2 != null) { Descripction = result2; gc.Gallery.ItemImageLayout = ImageLayoutMode.ZoomInside; gc.Gallery.ImageSize = new Size(120, 90); gc.Gallery.ShowItemText = true; Serie++; Valor = Serie.ToString(); Image im1 = Image.FromFile(OpenDialog.FileName); byte[] arr = null; arr = ImageAArray(im1); group1.Items.Add(new GalleryItem(im1, Valor, Descripction)); CLS_Activos ins = new CLS_Activos(); ins.Id_Activo = vId_Activo; ins.SerieImagen = Serie; ins.Descripcion = Descripction; ins.Imagen = arr; ins.MtdInsertarActivoImagen(); if (!ins.Exito) { XtraMessageBox.Show(ins.Mensaje); } } } }
private void itemCheckout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (gvNhanVien.GetFocusedRowCellValue("ID") == null) { XtraMessageBox.Show("Bạn chưa chọn dòng cần [Check Out].", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if ((bool?)gvNhanVien.GetFocusedRowCellValue("IsDangLam") != true) { XtraMessageBox.Show("Nhân viên này đã nghĩ việc.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var objBC = db.BangCongs.FirstOrDefault(p => p.NVID == (int)gvNhanVien.GetFocusedRowCellValue("ID") && SqlMethods.DateDiffDay(p.BatDau.GetValueOrDefault(), DateTime.Now) == 0); if (objBC == null) { XtraMessageBox.Show("Nhân viên này chưa [Check In].", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "CHECK IN"; args.Prompt = "Chọn thời gian"; args.DefaultButtonIndex = 0; // DateEdit lookBan = new DateEdit(); lookBan.Properties.CalendarTimeEditing = DevExpress.Utils.DefaultBoolean.True; // args.Editor = lookBan; args.DefaultResponse = DateTime.Now; // var result = XtraInputBox.Show(args).ToString(); var result1 = XtraInputBox.Show("Nhập nội dung", "Ghi Chú", objBC.GhiChu); objBC.KetThuc = DateTime.Parse(result); objBC.GhiChu = result1; } db.SubmitChanges(); XtraMessageBox.Show("Hoàn thành.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadDetail(); } catch { } }
private void btnExportarExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (dtgValVentaExistencia.RowCount > 0) { XtraFolderBrowserDialog saveFileDialog = new XtraFolderBrowserDialog(); if (saveFileDialog.ShowDialog() == DialogResult.OK) { string Cadena = saveFileDialog.SelectedPath; XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "Ingrese Nombre del Archivo Excel"; args.Prompt = "Nombre Archivo"; args.DefaultButtonIndex = 0; //args.Showing += Args_Showing; // initialize a DateEdit editor with custom settings TextEdit editor = new TextEdit(); args.Editor = editor; // a default DateEdit value args.DefaultResponse = "Nombre_Archivo_Excel"; // display an Input Box with the custom editor string result = string.Empty; result = XtraInputBox.Show(args).ToString(); if (result != string.Empty) { string path = Cadena + "\\" + result + ".xls"; dtgVentaExistencia.ExportToXlsx(path, new DevExpress.XtraPrinting.XlsxExportOptionsEx { AllowGrouping = DefaultBoolean.False, AllowFixedColumnHeaderPanel = DefaultBoolean.False }); System.Diagnostics.Process.Start(path); } else { XtraMessageBox.Show("No se ingreso Nombre para el Archivo a exportar"); } } } else { XtraMessageBox.Show("No existen registros para exportar"); } }
// добавить/редактировать направление private void btnAddDirections(int AddEdit) { XtraInputBoxArgs ib = new XtraInputBoxArgs(null, null, null, null, null, null); // окно ввода значения string result = ""; string NewId = ""; string IdClassifications = "NULL"; // запролняется при изменении записи TextEdit editor = new TextEdit(); // тип редактора в диалоге editor.Properties.MaxLength = 200; // макс кол-во знаков редакторе editor.Properties.NullValuePromptShowForEmptyValue = true; editor.Properties.ShowNullValuePromptWhenFocused = true; editor.Properties.NullValuePrompt = "Введите наименование направления (до " + System.Convert.ToString(editor.Properties.MaxLength) + " символов)"; ib.Editor = editor; ib.AllowHtmlText = DevExpress.Utils.DefaultBoolean.True; ib.Prompt = "<b><u>Наименование направления</b></u>"; ib.DefaultButtonIndex = 0; ib.Caption = System.Convert.ToString(AddEdit == 2 ? "Добавить направление" : "Редактировать направление"); // при редактировании записи if (AddEdit == 3) { IdClassifications = this.gvDirection.GetFocusedRowCellDisplayText("Id"); ib.DefaultResponse = this.gvDirection.GetFocusedRowCellDisplayText("Name"); // значение в поле ввода по умолчанию } result = clsForSQL.InDataBase(XtraInputBox.Show(ib)); if (result != "NULL") { NewId = System.Convert.ToString(mdQuery.ExecuteScalar( "EXEC Books_ResearchDirectionMethod " + "@IdDirection = " + IdClassifications + ", " + "@NameDirection = " + result + ", " + "@Parameter = 1, " + "@Function = " + System.Convert.ToString(AddEdit), "Books_ResearchDirectionMethod.Function = " + System.Convert.ToString(AddEdit) )); if (NewId != null && AddEdit == 2 && NewId != "err") { NewId_Direction = NewId; } } Designer_Direction(); }
private void repositoryItemButtonEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) { XtraInputBoxArgs args = new XtraInputBoxArgs(); args.Caption = "请输入密码"; args.Prompt = "密码"; var password = XtraInputBox.Show(args)?.ToString(); if (password == "admin") { var view = gridControl1.FocusedView as GridView; PurchaseViewModel row = (PurchaseViewModel)view.GetFocusedRow(); switch (row.Status) { case ProcessStatusEnum.采购入库: MessageBox.Show("该项已经入库无法重新申请"); break; case ProcessStatusEnum.申请审核中: MessageBox.Show("该项已经在申请审核中"); break; default: if (MessageBox.Show("确定重新申请", "重新申请", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No) { row.IsDeleted = true; _purchaseService.UpdatePurchase(row); RefreshData(true); } break; } } else { MessageBox.Show("密码错误"); return; } }
private void windowsUIButton_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e) { WindowsUIButton btn = e.Button as WindowsUIButton; XtraUserControl ctl = new XtraUserControl(); switch (btn.Tag.ToString()) { case "themsua": { enableButon(false); Commons.Modules.ObjSystems.AddnewRow(grvNgungDongBHXH, false); break; } case "xoa": { XoaBaoHiemYTe(); break; } case "luu": { Savedata(); LoadGridBaoHiemYTe(false); enableButon(true); Commons.Modules.ObjSystems.DeleteAddRow(grvNgungDongBHXH); break; } case "khongluu": { Commons.Modules.ObjSystems.DeleteAddRow(grvNgungDongBHXH); enableButon(true); break; } case "thoat": { Commons.Modules.ObjSystems.GotoHome(this); break; } case "ngayhethan": { try { XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "cập nhật ngày hết hạn"; args.Prompt = "Chọn ngày cập nhật"; args.DefaultButtonIndex = 0; // initialize a DateEdit editor with custom settings DateEdit editor = new DateEdit(); editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.Default; args.Editor = editor; // a default DateEdit value args.DefaultResponse = DateTime.Now.Date; // display an Input Box with the custom editor var result = XtraInputBox.Show(args); if (result.ToString() != "") { //cập nhật toàn bộ ngày cho bảo hiểm y tết string sSql = "UPDATE dbo.BAO_HIEM_Y_TE SET NGAY_HET_HAN ='" + Convert.ToDateTime(result).ToString("MM/dd/yyyy") + "'"; SqlHelper.ExecuteNonQuery(Commons.IConnections.CNStr, CommandType.Text, sSql); LoadGridBaoHiemYTe(false); } } catch (Exception) { } break; } } }
private void wbntSuaphong_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e) { XtraInputBoxArgs args = new XtraInputBoxArgs(); // set required Input Box options args.Caption = "Thêm ngày lễ"; args.Prompt = "Ngày:"; args.DefaultButtonIndex = 0; args.Showing += Args_Showing; // initialize a DateEdit editor with custom settings DateEdit editor = new DateEdit(); editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.TouchUI; editor.Properties.Mask.EditMask = "dd - MM"; args.Editor = editor; switch (e.Button.Properties.Tag.ToString()) { case "Thêm Ngày Lễ": args.DefaultResponse = DateTime.Now; if (XtraInputBox.Show(args) != null) { DateTime dt = new DateTime(2000, editor.DateTime.Month, editor.DateTime.Day); if (NgayLeBUS.KiemTraNgayLeTonTai(dt)) { XtraMessageBox.Show("Ngày lễ đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } NgayLeBUS.ThemNgayLe(new DTO.NgayLeDTO(NgayLeBUS.PhatSinhMaNgayLe(), editor.DateTime)); XtraMessageBox.Show("Thêm ngày lễ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); RefeshDataBinding(); } break; case "Xóa Ngày Lễ": if (XtraMessageBox.Show("Xác nhận xóa ngày lễ '" + ((DateTime)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["NgayLe"]).ToString("dd - MM") + "'?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { NgayLeBUS.XoaNgayLe((int)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["MaNgayLe"]); RefeshDataBinding(); } break; case "Sửa Ngày Lễ": args.DefaultResponse = (DateTime)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["NgayLe"]; if (XtraInputBox.Show(args) != null) { DateTime dt = new DateTime(2000, editor.DateTime.Month, editor.DateTime.Day); if (NgayLeBUS.KiemTraNgayLeTonTai(dt)) { XtraMessageBox.Show("Ngày lễ đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } NgayLeBUS.SuaNgayLe(new DTO.NgayLeDTO((int)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["MaNgayLe"], editor.DateTime)); XtraMessageBox.Show("Sửa ngày lễ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); RefeshDataBinding(); } break; case "Trở Lại": actionBack(); break; } }