示例#1
0
 /// <summary>
 /// Open window form
 /// </summary>
 /// <param name="frm">XtraForm</param>
 public static void OpenWindowForm(DevExpress.XtraEditors.XtraForm frm)
 {
     frm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
     frm.StartPosition   = FormStartPosition.CenterScreen;
     frm.WindowState     = FormWindowState.Normal;
     frm.ShowDialog();
 }
 private void OpenForm(DevExpress.XtraEditors.XtraForm xtraForm)
 {
     if (xtraForm != null)
     {
         xtraForm.MdiParent = this;
         xtraForm.Show();
     }
 }
示例#3
0
 /// <summary>
 /// 创建一个模式窗体.
 /// </summary>
 /// <returns></returns>
 private static DevExpress.XtraEditors.XtraForm NewForm()
 {
     DevExpress.XtraEditors.XtraForm xForm = new DevExpress.XtraEditors.XtraForm();
     xForm.FormBorderStyle = FormBorderStyle.None;
     xForm.Height          = 215;
     xForm.Width           = 525;
     xForm.StartPosition   = FormStartPosition.CenterScreen;
     return(xForm);
 }
示例#4
0
        public void GenerateDashboard(DoSoEmail email, bool prevewOnly = false)
        {
            var dashboardXml = Dashboard?.Xml;

            if (string.IsNullOrEmpty(dashboardXml))
            {
                return;
            }

            var width  = DashboardWidth ?? 1000;
            var height = DashboardHeight ?? 1000;

            using (var viewver = new DashboardViewer())
            {
                viewver.Dock = System.Windows.Forms.DockStyle.Fill;
                using (var ms = new MemoryStream())
                {
                    using (var sr = new StreamWriter(ms, Encoding.UTF8))
                    {
                        var doc = new XmlDocument();
                        doc.LoadXml(dashboardXml);
                        var definitionXml = doc.OuterXml;
                        sr.Write(definitionXml);
                        sr.Flush();
                        ms.Position = 0;
                        try
                        {
                            viewver.LoadDashboard(ms);
                        }
                        catch (Exception e)
                        {
                            throw;
                        }

                        viewver.Size = new System.Drawing.Size(width, height);

                        if (!prevewOnly)
                        {
                            var path = Path.Combine(email.FolderPath, "Dashboard" + ".png");
                            viewver.ExportToImage(path);
                            //email.SourceFilePath += path + ";";
                        }
                        else
                        {
                            using (var form = new DevExpress.XtraEditors.XtraForm())
                            {
                                form.Width     = width;
                                form.Height    = height;
                                viewver.Parent = form;
                                form.ShowDialog();
                            }
                        }
                    }
                }
            }
        }
示例#5
0
 private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (subFrmQuanLyHocVien != null)
     {
         subFrmQuanLyHocVien.Close();
     }
     subFrmQuanLyHocVien           = new TraCuuHocVien();
     subFrmQuanLyHocVien.MdiParent = this;
     subFrmQuanLyHocVien.Show();
 }
示例#6
0
 private void barButtonItem5_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (subFrmQuanLyHocVien != null)
     {
         subFrmQuanLyHocVien.Close();
     }
     subFrmQuanLyHocVien           = new LapBienLaiThuHocPhi();
     subFrmQuanLyHocVien.MdiParent = this;
     subFrmQuanLyHocVien.Show();
 }
示例#7
0
        // Tra cuu khoa hoc
        private void barButtonItem18_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (subFrmQuanLyGiangDay != null)
            {
                subFrmQuanLyGiangDay.Hide();
            }

            subFrmQuanLyGiangDay           = new TraCuuKhoaHoc();
            subFrmQuanLyGiangDay.MdiParent = this;
            subFrmQuanLyGiangDay.Show();
        }
示例#8
0
        // nhap lop hoc moi
        private void barButtonItem15_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (subFrmQuanLyGiangDay != null)
            {
                subFrmQuanLyGiangDay.Hide();
            }

            subFrmQuanLyGiangDay           = new NhapLopHocMoi();
            subFrmQuanLyGiangDay.MdiParent = this;
            subFrmQuanLyGiangDay.Show();
        }
示例#9
0
        // Danh sach luong giang vien
        private void barButtonItem14_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (subFrmQuanLyGiangDay != null)
            {
                subFrmQuanLyGiangDay.Hide();
            }

            subFrmQuanLyGiangDay           = new DanhSachLuongGiangVien();
            subFrmQuanLyGiangDay.MdiParent = this;
            subFrmQuanLyGiangDay.Show();
        }
示例#10
0
        // Nhap giang vien
        private void barButtonItem12_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (subFrmQuanLyGiangDay != null)
            {
                subFrmQuanLyGiangDay.Close();
            }

            subFrmQuanLyGiangDay           = new NhapGiangVien();
            subFrmQuanLyGiangDay.MdiParent = this;
            subFrmQuanLyGiangDay.Show();
        }
示例#11
0
 private DevExpress.XtraEditors.XtraForm getForm(DevExpress.XtraEditors.XtraForm form)
 {
     foreach (var child in MdiChildren)
     {
         if (child.Name.Equals(form.Name))
         {
             child.Activate();
             return((DevExpress.XtraEditors.XtraForm)child);
         }
     }
     return(null);
 }
示例#12
0
文件: ShowForm.cs 项目: whuacn/CJia
 /// <summary>
 /// 将系统选择窗口 ShowDialog 出来
 /// </summary>
 public static void ShowSelectSytem()
 {
     DevExpress.XtraEditors.XtraForm selectSystem = new DevExpress.XtraEditors.XtraForm();
     selectSystem.AutoSize        = true;
     selectSystem.FormBorderStyle = FormBorderStyle.FixedDialog;
     selectSystem.MaximizeBox     = false;
     selectSystem.Text            = "选择子系统";
     UI.SelectSystemView selectSystemView = new UI.SelectSystemView();
     selectSystem.Controls.Add(selectSystemView);
     selectSystem.StartPosition = FormStartPosition.CenterScreen;
     selectSystem.ShowDialog();
 }
示例#13
0
文件: ShowForm.cs 项目: whuacn/CJia
 /// <summary>
 /// 将登陆窗口 ShowDialog 出来
 /// </summary>
 public static void ShowLogin()
 {
     DevExpress.XtraEditors.XtraForm login = new DevExpress.XtraEditors.XtraForm();
     login.AutoSize        = true;
     login.FormBorderStyle = FormBorderStyle.FixedDialog;
     login.MaximizeBox     = false;
     login.StartPosition   = FormStartPosition.CenterScreen;
     login.Text            = ConfigurationSettings.AppSettings["SystemName"] + "登录";
     UI.LoginView loginView = new UI.LoginView();
     login.Controls.Add(loginView);
     login.ShowDialog();
 }
示例#14
0
 private bool ExitForm(DevExpress.XtraEditors.XtraForm frm)
 {
     foreach (var item in MdiChildren)
     {
         if (item.Name == frm.Name)
         {
             item.Activate();
             return(true);
         }
     }
     return(false);
 }
示例#15
0
        public void AddWindowX(string title, DevExpress.XtraEditors.XtraForm forms)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                bool add = true;

                //Recorro el xtabContenedor para saber si ya existe un tab de ese nombre abierto
                //de ser asi lo selecciono o si no creeo uno nuevo
                for (int x = 0; x < xTabContenedor.TabPages.Count; x++)
                {
                    //Comparo todos los tab con el nombre del nuevo tab que quiero crear
                    if (xTabContenedor.TabPages[x].Text == title)
                    {
                        xTabContenedor.TabPages[x].BackColor = Color.Azure;
                        xTabContenedor.SelectedTabPageIndex  = x;
                        add = false;
                        break;
                    }
                    //Si no existe un abierto "add" sera true
                    else
                    {
                        add = true;
                    }
                }

                if (add)
                {
                    //Creo un XtraTabPage que sera el que contendra el formulario
                    DevExpress.XtraTab.XtraTabPage myTabPage = new DevExpress.XtraTab.XtraTabPage();

                    myTabPage.Text        = title;
                    forms.TopLevel        = false;
                    forms.Visible         = true;
                    forms.FormBorderStyle = FormBorderStyle.None;
                    forms.Dock            = DockStyle.Fill;

                    myTabPage.BackColor = Color.Azure;
                    myTabPage.Controls.Add(forms);

                    xTabContenedor.TabPages.Add(myTabPage);

                    xTabContenedor.SelectedTabPageIndex = xTabContenedor.TabPages.Count - 1;
                }
            }
            catch (Exception exAddWindowsX)
            {
                ErrorSystem(exAddWindowsX.Message, "", "MenuPrincipal: AddWwindowX");
            }
            Cursor.Current = Cursors.Default;
        }
示例#16
0
 private void CreateMdiForm(DevExpress.XtraEditors.XtraForm form)
 {
     if (SessionHelper.member.FormPermId == 888 || SessionHelper.member.FormPermId == 999)
     {
         form.MdiParent = this;
         form.Show();
         form.BringToFront();
     }
     else
     {
         DevExpress.XtraEditors.XtraMessageBox.Show("Yetkiniz Bulunmuyor", "Uyarı", MessageBoxButtons.OK);
     }
 }
        private void ShowChild(DevExpress.XtraEditors.XtraForm frm)
        {
            var doc = documentManager1.GetDocument(frm);

            if (doc == null)
            {
                Helpers.Generic.ShowChild(this, frm);
            }
            else
            {
                tabbedView1.Controller.Activate(doc);
            }
        }
示例#18
0
 public void XtraForm_SetText(DevExpress.XtraEditors.XtraForm xtraForm, string text)
 {
     if (xtraForm.InvokeRequired)
     {
         xtraForm.Invoke(new Action(() =>
         {
             xtraForm.Text = text;
         }));
     }
     else
     {
         xtraForm.Text = text;
     }
 }
示例#19
0
 public void XtraForm_ControlsRemove(DevExpress.XtraEditors.XtraForm xtraForm, Control control)
 {
     if (xtraForm.InvokeRequired)
     {
         xtraForm.Invoke(new Action(() =>
         {
             xtraForm.Controls.Remove(control);
         }));
     }
     else
     {
         xtraForm.Controls.Remove(control);
     }
 }
示例#20
0
        protected override void OnNewRecord()
        {
            base.OnNewRecord();

            DevExpress.XtraEditors.XtraForm childform = null;

            switch (Type)
            {
            case BL.ORG.ORG_Type.Customer:
                childform = new Customer.CustomerForm();
                ShowForm(childform);
                break;

            case BL.ORG.ORG_Type.Supplier:
                childform = new Supplier.SupplierForm();
                ShowForm(childform);
                break;
            }
        }
示例#21
0
        private void TerminalItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DevExpress.XtraEditors.XtraForm newMDIChild = new DevExpress.XtraEditors.XtraForm();
            newMDIChild.MdiParent = this;
            newMDIChild.Tag       = 888;
            newMDIChild.Show();
            newMDIChild.Text = e.Item.Caption + " (" + Company.GetCurrCompany().CompanyName + ")";

            ucMain uc = new ucMain();

            uc.Size = newMDIChild.Size;
            uc.Dock = DockStyle.Fill;
            string keep = this.Text;

            uc.Parent = newMDIChild;
            tabbedView1.AddDocument(newMDIChild);

            this.Text = keep;
        }
示例#22
0
 internal static void IsOpenForm(DevExpress.XtraEditors.XtraForm p)
 {
     try
     {
         foreach (System.Windows.Forms.Form item in System.Windows.Forms.Application.OpenForms)
         {
             if (item.Name.Equals(p.Name))
             {
                 item.Activate();
                 p.Dispose();
                 return;
             }
         }
         p.Show();
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("CMN", 21) + ex.Message);
     }
 }
示例#23
0
        private void simpleAction_PreviwDashboard_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            //var os = Application.CreateObjectSpace();
            //var dashboard = os.GetObject(View.CurrentObject as DoSoDashboard);
            //var detailView = Application.CreateDetailView(os, dashboard);

            //var svp = new ShowViewParameters
            //{
            //    CreatedView = detailView,
            //    NewWindowTarget = NewWindowTarget.Default,
            //    TargetWindow = TargetWindow.Default,
            //};

            using (var viewver = new DashboardViewer())
            {
                viewver.Dock = System.Windows.Forms.DockStyle.Fill;
                using (var ms = new MemoryStream())
                {
                    using (var sr = new StreamWriter(ms, Encoding.Default))
                    {
                        var doc = new XmlDocument();
                        doc.LoadXml((View.CurrentObject as DoSoDashboard).Xml);
                        var definitionXml = doc.OuterXml;
                        sr.Write(definitionXml);
                        sr.Flush();
                        ms.Position = 0;
                        viewver.LoadDashboard(ms);
                        using (var form = new DevExpress.XtraEditors.XtraForm())
                        {
                            form.Width     = 1600;
                            form.Height    = 900;
                            viewver.Parent = form;
                            form.ShowDialog();
                        }
                    }
                }
            }
            //Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
        }
示例#24
0
        private static void ShowDevGridView(DataTable dataTable, string displayName, Control parent, Point point, Size size, EventHandler eventHandle, bool multiSelect, bool autoCalPoint, DataGridViewCellPaintingEventHandler cellPaintingEventHandle, ContextMenuForm contextMenuForm)
        {
            _callControl = parent;
            DevExpress.XtraGrid.GridControl         gridControl  = new DevExpress.XtraGrid.GridControl();
            DevExpress.XtraGrid.Views.Grid.GridView dataGridView = new DevExpress.XtraGrid.Views.Grid.GridView();
            gridControl.MainView = dataGridView;
            dataGridView.OptionsView.ShowColumnHeaders = false;
            dataGridView.OptionsView.ShowGroupPanel    = false;
            dataGridView.OptionsView.ShowIndicator     = false;
            //dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            //dataGridView.ColumnHeadersHeight = 18;
            //dataGridView.BackgroundColor = dataGridView.DefaultCellStyle.BackColor;
            //dataGridView.CellPainting += cellPaintingEventHandle;
            //dataGridView.CellPainting += new DataGridViewCellPaintingEventHandler(dataGridView_CellPainting);
            //dataGridView.GridColor = dataGridView.BackgroundColor;
            dataGridView.KeyPress += new KeyPressEventHandler(dataGridView_KeyPress);
            dataGridView.OptionsBehavior.ReadOnly = true;
            dataGridView.Tag = eventHandle;
            //DevExpress.XtraGrid.Columns.GridColumn column = dataGridView.Columns.Add();
            //column.FieldName =
            //"字典选择器", "字典选择器");
            //dataGridView.AllowUserToResizeRows = false;
            //dataGridView.AllowUserToResizeColumns = false;
            //dataGridView.ScrollBars = ScrollBars.Vertical;
            //dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            //dataGridView.Cursor = Cursors.Hand;
            string[] displayNames = null;
            string   ddd          = displayName;

            if (displayName != null)
            {
                displayNames = displayName.Split(new char[] { ',', ';' });
                for (int i = 0; i < displayNames.Length; i++)
                {
                    DevExpress.XtraGrid.Columns.GridColumn column = dataGridView.Columns.Add();
                    column.FieldName = displayNames[i];
                    column.OptionsColumn.AllowEdit       = false;
                    column.OptionsFilter.AllowAutoFilter = false;
                    column.OptionsFilter.AllowFilter     = false;
                    column.Visible      = true;
                    column.VisibleIndex = 0;
                    if (i == 0)
                    {
                        ddd = displayNames[i];
                    }
                }
            }
            _displayNames = displayNames;
            SetDataGridViewList(dataGridView, TransTable(dataTable, ddd));
            //dataGridView.Resize += new EventHandler(delegate(object sender1, EventArgs e1)
            //{
            //    for (int i = 0; i < dataGridView.Columns.Count - 1; i++)
            //    {
            //        dataGridView.Columns[i].Width = 120;
            //    }
            //    int width = dataGridView.Width - 120 * (dataGridView.Columns.Count - 1);
            //    if (width < 1)
            //    {
            //        dataGridView.Columns[dataGridView.Columns.Count - 1].Visible = false;
            //    }
            //    else
            //    {
            //        dataGridView.Columns[dataGridView.Columns.Count - 1].Width = width;
            //    }
            //});
            //dataGridView.CellDoubleClick += new DataGridViewCellEventHandler(delegate(object sender, DataGridViewCellEventArgs e)
            //{
            //    if (dataGridView.CurrentRow != null && dataGridView.CurrentRow.Index >= 0)
            //    {
            //        if (eventHandle != null)
            //        {
            //            if (multiSelect)
            //            {
            //                List<int> selectedIndexes = new List<int>();
            //                foreach (DataGridViewCell cell in dataGridView.SelectedCells)
            //                {
            //                    selectedIndexes.Add(_showListItems[cell.RowIndex].Index);
            //                }
            //                selectedIndexes.Reverse();
            //                eventHandle(selectedIndexes.ToArray(), null);
            //                if (dataGridView.Parent != null && dataGridView.Parent is DevExpress.XtraEditors.XtraForm)
            //                {
            //                    (dataGridView.Parent as DevExpress.XtraEditors.XtraForm).Close();
            //                }
            //                dataGridView.Dispose();
            //            }
            //        }
            //    }
            //});
            dataGridView.KeyDown += new KeyEventHandler(dataGridView_KeyDown);
            if (!multiSelect)
            {
                //dataGridView.MouseMove += new MouseEventHandler(delegate(object sender, MouseEventArgs e)
                //{
                //    int rowIndex = dataGridView.get .HitTest(e.X, e.Y).RowIndex;
                //    if (rowIndex >= 0)
                //    {
                //        dataGridView.CurrentCell = dataGridView.Rows[rowIndex].Cells[0];
                //    }
                //});
                //dataGridView.CellClick += new DataGridViewCellEventHandler(delegate(object sender, DataGridViewCellEventArgs e)
                dataGridView.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(delegate(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
                {
                    if (eventHandle != null)
                    {
                        eventHandle(dataGridView.GetDataRow(e.RowHandle), e);
                    }
                    try
                    {
                        if (gridControl.Parent != null && gridControl.Parent is DevExpress.XtraEditors.XtraForm)
                        {
                            (gridControl.Parent as DevExpress.XtraEditors.XtraForm).Close();
                        }
                        dataGridView.Dispose();
                        gridControl.Dispose();
                    }
                    catch
                    {
                    }
                });
            }
            if (size.Width < 100)
            {
                size.Width = 100;
            }
            //dataGridView.CellMouseDown += new DataGridViewCellMouseEventHandler(dataGridView_CellMouseDown);
            //dataGridView.CellMouseMove += new DataGridViewCellMouseEventHandler(dataGridView_CellMouseMove);
            //dataGridView.CellMouseUp += new DataGridViewCellMouseEventHandler(dataGridView_CellMouseUp);

            DevExpress.XtraEditors.XtraForm form = new DevExpress.XtraEditors.XtraForm();
            form.TopMost       = true;
            form.StartPosition = FormStartPosition.Manual;
            form.Location      = parent.PointToScreen(point);
            form.Size          = size;
            if (parent != null && !(parent is DataGridView))
            {
                form.Width = parent.Width;
            }
            form.Controls.Add(gridControl);
            gridControl.Dock     = DockStyle.Fill;
            form.Deactivate     += new EventHandler(form_Deactivate);
            form.FormBorderStyle = FormBorderStyle.None;
            if (form.Bottom > Screen.PrimaryScreen.Bounds.Height)
            {
                if (form.Top >= form.Height)
                {
                    form.Top -= form.Height;
                }
                else
                {
                    form.Top = 0;
                }
            }
            form.Width = size.Width;
            form.Show();
        }
示例#25
0
        private static void ShowDataGridView(IEnumerable list, string displayName, Control parent, Point point, Size size, EventHandler eventHandle, bool multiSelect, bool autoCalPoint, DataGridViewCellPaintingEventHandler cellPaintingEventHandle, ContextMenuForm contextMenuForm)
        {
            _callControl = parent;
            DataGridView dataGridView = new DataGridView();

            dataGridView.ColumnHeadersVisible        = false;
            dataGridView.RowHeadersVisible           = false;
            dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            dataGridView.ColumnHeadersHeight         = 18;
            dataGridView.BackgroundColor             = dataGridView.DefaultCellStyle.BackColor;
            dataGridView.CellPainting         += cellPaintingEventHandle;
            dataGridView.CellPainting         += new DataGridViewCellPaintingEventHandler(dataGridView_CellPainting);
            dataGridView.GridColor             = dataGridView.BackgroundColor;
            dataGridView.KeyPress             += new KeyPressEventHandler(dataGridView_KeyPress);
            dataGridView.ReadOnly              = true;
            dataGridView.AllowUserToAddRows    = false;
            dataGridView.AllowUserToDeleteRows = false;
            dataGridView.Columns.Add("字典选择器", "字典选择器");
            dataGridView.AllowUserToResizeRows    = false;
            dataGridView.AllowUserToResizeColumns = false;

            dataGridView.ScrollBars = ScrollBars.Vertical;

            dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView.Cursor        = Cursors.Hand;
            string[] displayNames = null;
            if (displayName != null)
            {
                displayNames = displayName.Split(new char[] { ',', ';' });
                for (int i = 1; i < displayNames.Length; i++)
                {
                    dataGridView.Columns.Add("Column" + i.ToString(), "Column");
                }
                if (dataGridView.Columns.Count > 1)
                {
                    dataGridView.ScrollBars = ScrollBars.Both;
                }
            }
            _displayNames = displayNames;
            GenListItems();
            SetDataGridViewList(dataGridView);

            dataGridView.Resize += new EventHandler(delegate(object sender1, EventArgs e1)
            {
                for (int i = 0; i < dataGridView.Columns.Count - 1; i++)
                {
                    //dataGridView.Columns[i].Width = 120;
                    dataGridView.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                }
                //Modify by wenpei.x@2014-02-12
                //新增人员选择下拉框显示User_ID,故宽度不应该再有限制
                if (dataGridView.Columns.Count <= 1)
                {
                    int width = dataGridView.Width - 120 * (dataGridView.Columns.Count - 1);
                    if (width < 1)
                    {
                        dataGridView.Columns[dataGridView.Columns.Count - 1].Visible = false;
                    }
                    else
                    {
                        dataGridView.Columns[dataGridView.Columns.Count - 1].Width = width;
                    }
                }
            });
            dataGridView.CellDoubleClick += new DataGridViewCellEventHandler(delegate(object sender, DataGridViewCellEventArgs e)
            {
                if (dataGridView.CurrentRow != null && dataGridView.CurrentRow.Index >= 0)
                {
                    if (eventHandle != null)
                    {
                        if (multiSelect)
                        {
                            List <int> selectedIndexes = new List <int>();
                            foreach (DataGridViewCell cell in dataGridView.SelectedCells)
                            {
                                selectedIndexes.Add(_showListItems[cell.RowIndex].Index);
                            }
                            selectedIndexes.Reverse();
                            eventHandle(selectedIndexes.ToArray(), null);
                            if (dataGridView.Parent != null && dataGridView.Parent is DevExpress.XtraEditors.XtraForm)
                            {
                                (dataGridView.Parent as DevExpress.XtraEditors.XtraForm).Close();
                            }
                            dataGridView.Dispose();
                        }
                    }
                }
            });
            dataGridView.KeyDown += new KeyEventHandler(delegate(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (dataGridView.CurrentRow != null && dataGridView.CurrentRow.Index >= 0)
                    {
                        if (eventHandle != null)
                        {
                            if (multiSelect)
                            {
                                List <int> selectedIndexes = new List <int>();
                                foreach (DataGridViewCell cell in dataGridView.SelectedCells)
                                {
                                    selectedIndexes.Add(_showListItems[cell.RowIndex].Index);
                                }
                                selectedIndexes.Reverse();
                                eventHandle(selectedIndexes.ToArray(), null);
                            }
                            else
                            {
                                eventHandle(_showListItems[dataGridView.CurrentRow.Index].Index, null);
                            }
                        }
                        if (dataGridView.Parent != null && dataGridView.Parent is DevExpress.XtraEditors.XtraForm)
                        {
                            (dataGridView.Parent as DevExpress.XtraEditors.XtraForm).Close();
                        }
                        dataGridView.Dispose();
                    }
                }
                else if (e.KeyCode == Keys.Escape)
                {
                    if (dataGridView.Parent != null && dataGridView.Parent is DevExpress.XtraEditors.XtraForm)
                    {
                        (dataGridView.Parent as DevExpress.XtraEditors.XtraForm).Close();
                    }
                    dataGridView.Dispose();
                    if (_callControl != null)
                    {
                        _callControl.Focus();
                    }
                }
            });
            if (!multiSelect)
            {
                dataGridView.MouseMove += new MouseEventHandler(delegate(object sender, MouseEventArgs e)
                {
                    int rowIndex = dataGridView.HitTest(e.X, e.Y).RowIndex;
                    if (rowIndex >= 0)
                    {
                        dataGridView.CurrentCell = dataGridView.Rows[rowIndex].Cells[0];
                    }
                });
                dataGridView.CellClick += new DataGridViewCellEventHandler(delegate(object sender, DataGridViewCellEventArgs e)
                {
                    if (dataGridView.CurrentRow != null && dataGridView.CurrentRow.Index >= 0)
                    {
                        if (eventHandle != null)
                        {
                            eventHandle(_showListItems[dataGridView.CurrentRow.Index].Index, null);
                        }
                        try
                        {
                            if (dataGridView.Parent != null && dataGridView.Parent is DevExpress.XtraEditors.XtraForm)
                            {
                                (dataGridView.Parent as DevExpress.XtraEditors.XtraForm).Close();
                            }
                            dataGridView.Dispose();
                        }
                        catch
                        {
                        }
                    }
                });
            }
            if (size.Width < 100)
            {
                size.Width = 100;
            }
            dataGridView.CellMouseDown += new DataGridViewCellMouseEventHandler(dataGridView_CellMouseDown);
            dataGridView.CellMouseMove += new DataGridViewCellMouseEventHandler(dataGridView_CellMouseMove);
            dataGridView.CellMouseUp   += new DataGridViewCellMouseEventHandler(dataGridView_CellMouseUp);

            DevExpress.XtraEditors.XtraForm form = new DevExpress.XtraEditors.XtraForm();
            form.TopMost       = true;
            form.StartPosition = FormStartPosition.Manual;
            form.Location      = parent.PointToScreen(point);
            form.Size          = size;
            //if (parent != null && !(parent is DataGridView))
            //{
            //    form.Width = parent.Width;
            //}
            form.Controls.Add(dataGridView);
            dataGridView.Dock    = DockStyle.Fill;
            form.Deactivate     += new EventHandler(form_Deactivate);
            form.FormBorderStyle = FormBorderStyle.None;
            if (form.Bottom > Screen.PrimaryScreen.Bounds.Height)
            {
                if (form.Top >= form.Height)
                {
                    form.Top -= form.Height;
                }
                else
                {
                    form.Top = 0;
                }
            }
            form.Show();

            //if (size.Height > dataGridView.RowTemplate.Height * dataGridView.Rows.Count + dataGridView.ColumnHeadersHeight)
            //{
            //    dataGridView.ColumnHeadersVisible = false;
            //    Control parentControl = parent;
            //    Dialog.SetPopup(dataGridView, parent, point, new Size(size.Width, dataGridView.RowTemplate.Height * dataGridView.Rows.Count + 3), autoCalPoint);
            //}
            //else
            //{
            //    Control parentControl = parent;
            //    Dialog.SetPopup(dataGridView, parent, point, size, autoCalPoint);
            //}
        }
示例#26
0
        //CAC HAM KIEM TRA TON TAI TAB VA TAO TAB
        // <summary>
        /// Tạo thêm tab mới
        /// </summary>
        /// <param name="tabControl">Tên TabControl để add thêm tabpage mới vào</param>
        /// <param name="Text">Tiêu đề tabpage mới</param>
        /// <param name="Name">Tên tabpage mới</param>
        /// <param name="form">Tên form con của tab mới</param>
        /// <param name="imageIndex">index của icon</param>
        public void TaoTab(DevExpress.XtraTab.XtraTabControl tabControl, string Text, string Name, DevExpress.XtraEditors.XtraForm form, int imageIndex)
        {
            int index = KiemTraTonTai(tabControl, Name);

            if (index >= 0)
            {
                tabControl.SelectedTabPage      = tabControl.TabPages[index];
                tabControl.SelectedTabPage.Text = Text;
            }
            else
            {
                DevExpress.XtraTab.XtraTabPage tabpage = new DevExpress.XtraTab.XtraTabPage {
                    Text = Text, Name = Name, ImageIndex = imageIndex
                };
                tabControl.TabPages.Add(tabpage);
                tabControl.SelectedTabPage = tabpage;

                form.TopLevel = false;
                form.Parent   = tabpage;
                form.Show();
                form.Dock = DockStyle.Fill;
            }
        }
示例#27
0
 public csYetkilendirmeyeGoreButonlariDuzenle(DevExpress.XtraEditors.XtraForm Form)
 {
 }
示例#28
0
        /// <summary>
        /// Adds the form tot the list of this.MdiChildren
        /// </summary>
        /// <param name="form"></param>
        public void ShowForm(DevExpress.XtraEditors.XtraForm form)
        {
            try
            {
                using (new Essential.UTL.WaitCursor())
                {
                    //Check if there is already a form of the same type open and select it
                    //instead of opening a new one
                    if (form is Essential.BaseList && !(form as Essential.BaseList).ForceNew)
                    {
                        if (form is Document.BaseDocumentList)
                        {
                            if (!
                                Parallel.ForEach(this.MdiChildren.Where(n => (n as Document.BaseDocumentList) != null), (child, pls) =>
                            {
                                if ((child as Document.BaseDocumentList).DocumentType == (form as Document.BaseDocumentList).DocumentType)
                                {
                                    //If the List is already open select it if not the form with open
                                    this.BeginInvoke(new Action(() => child.Select()));
                                    //child.Select();
                                    //return;
                                    pls.Break();
                                }
                            }).IsCompleted)
                            {
                                return;
                            }
                            //foreach (var child in this.MdiChildren.Where(n => (n as Document.BaseDocumentList) != null))
                            //{
                            //    if ((child as Document.BaseDocumentList).DocumentType == (form as Document.BaseDocumentList).DocumentType)
                            //    {
                            //        //If the List is already open select it if not the form with open
                            //        child.Select();
                            //        return;
                            //    }
                            //}
                        }
                        else if (form is Company.CompanyList)
                        {
                            if (!
                                Parallel.ForEach(this.MdiChildren.Where(n => (n as Company.CompanyList) != null), (child, pls) =>
                            {
                                if ((child as Company.CompanyList).Type == (form as Company.CompanyList).Type)
                                {
                                    //If the List is already open select it if not the form with open
                                    this.BeginInvoke(new Action(() => child.Select()));
                                    pls.Break();
                                }
                            }).IsCompleted)
                            {
                                return;
                            }
                            //foreach (var child in this.MdiChildren.Where(n => (n as Company.CompanyList) != null))
                            //{
                            //    if ((child as Company.CompanyList).Type == (form as Company.CompanyList).Type)
                            //    {
                            //        //If the List is already open select it if not the form with open
                            //        child.Select();
                            //        return;
                            //    }
                            //}
                        }
                        else
                        {
                            if (!
                                Parallel.ForEach(this.MdiChildren, (child, pls) =>
                            {
                                if (child.Text == form.Text)
                                {
                                    //If the List is already open select it if not the form with open
                                    this.BeginInvoke(new Action(() => child.Select()));
                                    pls.Break();
                                }
                            }).IsCompleted)
                            {
                                return;
                            }
                            //foreach (var child in this.MdiChildren)
                            //{
                            //    if (child.Text == form.Text)
                            //    {
                            //        //If the List is already open select it if not the form with open
                            //        child.Select();
                            //        return;
                            //    }
                            //}
                        }
                    }

                    form.FormClosing += form_FormClosing;
                    form.FormClosed  += form_FormClosed;

                    form.MdiParent = MainForm.Instance;
                    form.Show();
                    form.Focus();
                    //if (this.MdiChildren.Count() != 1)
                    //    bbiSite.Enabled = false;

                    //if (form is CDS.Client.Desktop.Document.BaseDocument)
                    //{
                    //    if ((form as CDS.Client.Desktop.Document.BaseDocument).TabColor != null)
                    //    {
                    //        MdiManager.Pages[MdiManager.Pages.Count - 1].Appearance.HeaderActive.BackColor = (form as CDS.Client.Desktop.Document.BaseDocument).TabColor;
                    //        MdiManager.Pages[MdiManager.Pages.Count - 1].Appearance.HeaderDisabled.BackColor = (form as CDS.Client.Desktop.Document.BaseDocument).TabColor;
                    //    }
                    //}
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
示例#29
0
        public void StartConfig()
        {
            App.ConfigurationManager = new BeSmartMRP.Business.Agents.ConfigurationAgent();
#if !xd_RUNMODE_DEBUG
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
#endif

#if !xd_RUNMODE_DEBUG
            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
#endif

            this.pmLoadConfig();

            //this.pmDBChkUpdate();

            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            App.PermissionManager           = new BeSmartMRP.Business.Agents.SecurityAgent();
            App.PermissionManager.SQLHelper = pobjSQLUtil;
            //App.PermissionManager = new BeSmartMRP.Business.Agents.SecurityAgent(App.ConnectionString, App.DatabaseReside);
            //App.PermissionManager.ModuleID = App.AppID;
            //App.PermissionManager.ConnectionString2 = App.xd_Access_ConnectionString;

            switch (this.mstrModule)
            {
            case "POS":
                App.ofrmMainMenu = new BeSmartMRP.frmMainMenuPOS1();
                App.AppModule    = "POS1_SYS";
                break;

            default:
                App.ofrmMainMenu = new BeSmartMRP.frmMainmenu();
                App.AppModule    = "MRPI_SYS";
                break;
            }

#if xd_VERSION_DEMO
            if (XD_EXPIREDATE.CompareTo(DateTime.Now) < 0)
            {
                MessageBox.Show("Database is Access Deny", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            else
            {
                using (BeSmartMRP.DialogForms.frmLogin dlg = new BeSmartMRP.DialogForms.frmLogin())
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Application.Run(App.ofrmMainMenu);
                        //Application.Run(new Form1());
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
            }
#else
            using (BeSmartMRP.DialogForms.frmLogin dlg = new BeSmartMRP.DialogForms.frmLogin())
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    App.AppDBChkUpdate();

                    Application.Run(App.ofrmMainMenu);
                }
                else
                {
                    Application.Exit();
                }
            }
#endif
        }
示例#30
0
 public void ShowDialog(string type,GMapMarker marker) {
     if (type == "jcky") {//交叉跨跃
         if (marker.Tag is sd_gt) {
             sd_gt gt = marker.Tag as sd_gt;
             Ebada.Scgl.Sbgl.UCsd_jcky jcky = new UCsd_jcky();
             jcky.ParentObj = gt;
             DevExpress.XtraEditors.XtraForm dlg = new DevExpress.XtraEditors.XtraForm();
             dlg.Controls.Add(jcky);
             jcky.Dock = DockStyle.Fill;
             jcky.HideList();
             dlg.Size = new System.Drawing.Size(800, 600);
             dlg.StartPosition = FormStartPosition.CenterScreen;
             dlg.Text = "交叉跨越-" + gt.gth;
             dlg.ShowDialog();
         } else {
             PS_gt gt = selectedMarker.Tag as PS_gt;
             Ebada.Scgl.Sbgl.UCPS_jcky jcky = new UCPS_jcky();
             jcky.ParentObj = gt;
             DevExpress.XtraEditors.XtraForm dlg = new DevExpress.XtraEditors.XtraForm();
             dlg.Controls.Add(jcky);
             jcky.Dock = DockStyle.Fill;
             jcky.HideList();
             dlg.Size = new System.Drawing.Size(800, 600);
             dlg.StartPosition = FormStartPosition.CenterScreen;
             dlg.Text = "交叉跨越-" + gt.gth;
             dlg.ShowDialog();
         }
     } else {
         MessageBox.Show("此功能正在开发中。。。");
     }
 }
示例#31
0
        private void GetReport(string FormsID)
        {
            string GetReportRL = string.Format(@"/api/Report/GetReport/");
            var    client      = new ClientConnect();
            var    param       = new Dictionary <string, string>();
            var    header      = new Dictionary <string, string>();

            param.Add("FormsID", FormsID);
            _Forms.UniqueDataStructure.AcceptChanges();
            DataSet TheData = new DataSet();

            TheData.Tables.Clear();
            if (_Forms.UniqueDataStructure.DataSet != null)
            {
                DataSet dss = _Forms.UniqueDataStructure.DataSet;
                dss.Tables.Remove(_Forms.UniqueDataStructure);
            }

            TheData.Tables.Add(_Forms.UniqueDataStructure);
            string JSOResult;

            JSOResult = JsonConvert.SerializeObject(TheData, Formatting.Indented);
            try
            {
                var response = Task.Run(() => client.PostWithBodyAndParameters(GetReportRL, param, JSOResult)).Result;
                _PrintedForm = JsonConvert.DeserializeObject <PrintedForm>(response);
                string txtPDF = _PrintedForm.PDFLocation;

                if (File.Exists(@_PrintedForm.PDFLocation))
                {
                    if (MoveToProdind)
                    {
                        ////Process.Start("explorer.exe", _PrintedForm.PDFLocation);
                        //PdfViewer i = new PdfViewer();
                        //DevExpress.XtraEditors.XtraForm jj = new DevExpress.XtraEditors.XtraForm();
                        //i.LoadDocument(@_PrintedForm.PDFLocation);
                        //i.Dock = DockStyle.Fill;
                        //i.ZoomMode = PdfZoomMode.FitToWidth;
                        //i.NavigationPanePageVisibility = PdfNavigationPanePageVisibility.None;
                        //jj.Controls.Add(i);
                        //jj.Width = 600;
                        //jj.Height = 800;

                        //jj.ShowIcon = false;
                        //jj.Text = "OCR - DOCUMENT PREVIEW";
                        //i.CreateRibbon();
                        //jj.ShowDialog();
                        ////if (barCheckItem1.Checked == true)
                        ////{
                        ////    PdfPrinterSettings ps = new PdfPrinterSettings();
                        ////    i.Print(ps);
                        ////}

                        DateTime i            = DateTime.Now;
                        string   newFolder    = "Mineware_OCR";
                        string   newFolderDay = newFolder + @"\" + i.ToString("yyyy'_'MM'_'dd") + "_BulkPrint";

                        string path = System.IO.Path.Combine(
                            Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                            newFolder
                            );

                        if (!System.IO.Directory.Exists(path))
                        {
                            try
                            {
                                System.IO.Directory.CreateDirectory(path);
                            }
                            catch (IOException ie)
                            {
                                Console.WriteLine("IO Error: " + ie.Message);
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("General Error: " + e.Message);
                            }
                        }

                        string pathDay = System.IO.Path.Combine(
                            Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                            newFolderDay
                            );

                        if (!System.IO.Directory.Exists(pathDay))
                        {
                            try
                            {
                                System.IO.Directory.CreateDirectory(pathDay);
                            }
                            catch (IOException ie)
                            {
                                Console.WriteLine("IO Error: " + ie.Message);
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("General Error: " + e.Message);
                            }
                        }

                        string sourceFile = System.IO.Path.Combine(Path.GetDirectoryName(@_PrintedForm.PDFLocation), Path.GetFileName(@_PrintedForm.PDFLocation));
                        string destFile   = System.IO.Path.Combine(pathDay, Path.GetFileName(@_PrintedForm.PDFLocation));
                        System.IO.File.Copy(sourceFile, destFile, true);
                    }
                    else
                    {
                        PdfViewer i = new PdfViewer();
                        DevExpress.XtraEditors.XtraForm jj = new DevExpress.XtraEditors.XtraForm();
                        i.LoadDocument(@_PrintedForm.PDFLocation);
                        i.Dock     = DockStyle.Fill;
                        i.ZoomMode = PdfZoomMode.FitToWidth;
                        i.NavigationPanePageVisibility = PdfNavigationPanePageVisibility.None;
                        jj.Controls.Add(i);
                        jj.Width  = 600;
                        jj.Height = 800;

                        jj.ShowIcon = false;
                        jj.Text     = "CHECKLIST EXAMPLE - CANNOT BE PRINTED";
                        jj.ShowDialog();
                        //if (i.PageCount / Convert.ToInt32(_PrintedForm.PrintedFromID.Count().ToString())==1)
                        //    { }
                    }
                }
            }
            catch (Exception error)
            {
            }
        }