Esempio n. 1
0
        private void PermitView_Load(object sender, EventArgs e)
        {
            this.btnClose.Left = this.Width - this.btnClose.Width - 30;
            this.btnOK.Left    = this.btnClose.Left - this.btnOK.Width - 10;
            roleGridEdit1.LoadData();
            treeCtl1.AfterCheckNode += treeCtl1_AfterCheckNode; treeCtl1.Enabled = false;
            t_menu mnu;

            using (var db = new Database())
            {
                mnu = db.FirstOrDefault <t_menu>("select * from t_menu");
                //解析菜单XML
                treeCtl1.ClearNodes();
                ExtractMenu(mnu.MenuXml);
            }
            dlg = new DevExpress.Utils.WaitDialogForm("正在加载权限设置信息 ...",
                                                      "数据加载中");


            var t = new Thread(() =>
            {
                //加载菜单
                this.Invoke(new Action(() =>
                {
                    BuildlRoleTree(); Visible = true;
                }));
                this.Invoke(new Action(() => dlg.Close()));
            });

            t.SetApartmentState(ApartmentState.STA);
            t.IsBackground = true;
            t.Start();
        }
Esempio n. 2
0
        private void btnImp_Click(object sender, EventArgs e)
        {
            if (MsgBox.ShowYesNoMessage("", "确定要导入吗?") == System.Windows.Forms.DialogResult.No)
            {
                return;
            }
            var dlg = new DevExpress.Utils.WaitDialogForm("正在导入,请稍候...", "导入");

            try {
                var ds = GridControl.GetDataSource <t_item>();
                if (null == ds || ds.Count < 1)
                {
                    return;
                }
                //var gid = Guid.NewGuid();
                ds.ForEach(j => {
                    j.Guid = Guid.NewGuid();
                });

                //插入临时表

                //同步到正式表
            } catch (Exception) {
                throw;
            } finally {
                dlg.Close();
            }
            MsgBox.ShowMessage("", "导入已完成!");
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Esempio n. 3
0
        private void fileBrowser1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (null == FieldsMapper)
            {
                return;
            }

            var filedlg = new OpenFileDialog();

            filedlg.Filter = this.FileFilter;
            if (filedlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                fileBrowser1.Text = filedlg.FileName;
                //读取文件数据
                var dlg = new DevExpress.Utils.WaitDialogForm("正在加载数据,请稍候...", "导入");
                try {
                    var ipitm = ExcelCommon.ReadXls <t_item>(fileBrowser1.Text, FieldsMapper);
                    this.GridControl.DataSource = ipitm;
                } catch (Exception) {
                    throw;
                } finally {
                    dlg.Close();
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Initialize the view to be shown
        /// </summary>
        private void Initialize()
        {
            try
            {
                this.m_view = base.CreateView() as IGridControlTextView;
                using (DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("请稍等", "正在登录中...",
                                                                                                 new System.Drawing.Size(200, 50),
                                                                                                 null))
                {
                    SetGridStyle(this.m_view.GridView);
                    InitData();
                    InitializeRepository();

                    m_view.BtnPrePrint.Click += BtnPrePrint_Click;
                    m_view.BtnAddClass.Click += BtnAddClass_Click;
                    m_view.BtnDelClass.Click += BtnDelClass_Click;
                    m_view.StudentsBindingSource.PositionChanged += StudentsBindingSource_PositionChanged;
                    m_view.ClassesBindingSource.PositionChanged  += ClassesBindingSource_PositionChanged;
                    m_view.StudentRepository.Click      += StudentRepository_Click;
                    m_view.ClassesBindingSource.Position = 0;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
        private void btnImp_Click(object sender, EventArgs e)
        {
            if (MsgBox.ShowYesNoMessage("", "确定要导入吗?") == System.Windows.Forms.DialogResult.No)
                return;
            var dlg = new DevExpress.Utils.WaitDialogForm("正在导入,请稍候...", "导入");
            try {
                var ds = GridControl.GetDataSource<t_item>();
                if (null == ds || ds.Count < 1)
                    return;
                //var gid = Guid.NewGuid();
                ds.ForEach(j => {
                    j.Guid = Guid.NewGuid();
                });

                //插入临时表

                //同步到正式表

            } catch (Exception) {

                throw;
            } finally {
                dlg.Close();
            }
            MsgBox.ShowMessage("", "导入已完成!");
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Esempio n. 6
0
        public IEnumerable <Object> getAllEmployeeNotChecked(Int64 id)
        {
            var dlg = new DevExpress.Utils.WaitDialogForm("Đang tải dữ liệu ...", "Thông báo");

            try
            {
                db.Dispose( );
                db = new DTO.DataClasses1DataContext( );
                db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues);
                var datasource = from emp in db.ST_employees
                                 join dep in db.ST_departments on emp.department_id equals dep.department_id
                                 where !(from citem in db.ST_detail_employee_constructions
                                         select citem.employee_id).Contains(emp.employee_id)
                                 select new {
                    emp.employee_id, emp.employee_id_custom, emp.employee_name, emp.employee_address, emp.employee_date_of_birth, emp.employee_phone, dep.department_name, dep.department_price, emp.employee_status
                };

                return(datasource);
            }
            catch (Exception)
            {
                return(null);
            }
            finally
            {
                dlg.Close( );
            }
        }
Esempio n. 7
0
        public TC_PhieuThu(String mPhieuTCID, String mLoaiPhieu, String mTuNgay, String mDenNgay,
                           MTGlobal.MT_ROLE mActRole, bool isAddNew = false)
        {
            InitializeComponent();
            this.lblTitle.Content = "LẬP PHIẾU THU";
            this.pPhieuTCID       = mPhieuTCID;
            this.pTuNgay          = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay;
            this.pDenNgay         = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay;
            this.pLoaiPhieu       = mLoaiPhieu;
            this.pACT_ROLE        = mActRole;

            Dlg = Utils.shwWait();

            setUserRight();
            if (isAddNew)
            {
                fdoAdd();
            }
            else
            {
                BindData();
                MTGlobal.SetGridReadOnly(grdPhieuThuCT, tblView, true);
                setReadOnly(true);
            }

            Utils.closeWait(Dlg);
        }
        void refreshData()
        {
            DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү.");

            try
            {
                dlg.Show();

                mainTableDTLGrid = new DataTable();
                adapterDTLGrid   = new SqlDataAdapter("SELECT * FROM TBLBOOKREMAINDER ORDER BY CREATED DESC", frmMain.conn);
                builderDTLGrid   = new SqlCommandBuilder(adapterDTLGrid);
                adapterDTLGrid.Fill(mainTableDTLGrid);
                frmMain.dataTableColumnNameToUpper(mainTableDTLGrid);

                mainTableDTLGridView = new DataTable();
                adapterDTLGridView   = new SqlDataAdapter("SELECT TBLBOOKREMAINDER.*, TBLBOOK.NAME, TBLBOOK.CODE FROM TBLBOOKREMAINDER LEFT JOIN TBLBOOK ON TBLBOOK.BOOKID = TBLBOOKREMAINDER.BOOKID ORDER BY TBLBOOKREMAINDER.CREATED", frmMain.conn);
                adapterDTLGridView.Fill(mainTableDTLGridView);
                frmMain.dataTableColumnNameToUpper(mainTableDTLGridView);
                gridControl1.DataSource = mainTableDTLGridView;

                barSave.Enabled    = false;
                barCancel.Enabled  = false;
                barRefresh.Enabled = true;

                dlg.Close();
            }
            catch (Exception ex)
            {
                dlg.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message);
            }
        }
Esempio n. 9
0
        public TC_PhieuThuFrm(String mPhieuTCID, String mLoaiPhieu, String mTuNgay, String mDenNgay,
                              MTGlobal.MT_ROLE mActRole, bool isAddNew = false)
        {
            InitializeComponent();
            this.pPhieuTCID = mPhieuTCID;
            this.pTuNgay    = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay;
            this.pDenNgay   = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay;
            this.pLoaiPhieu = mLoaiPhieu;
            this.pACT_ROLE  = mActRole;

            lblTitle.Text     = mLoaiPhieu == MTGlobal.PT ? "Phiếu thu - " + MTGlobal.RPT_COMPANY : "Phiếu chi - " + MTGlobal.RPT_COMPANY;
            lblTitleText.Text = mLoaiPhieu == MTGlobal.PT ? "Phiếu thu" : "Phiếu chi";

            Dlg = Utils.shwWait();

            setUserRight();
            loadCustomerToLookupEdit();
            loadLydoToLookupEdit();
            loadNhanVienToLookupEdit();
            loadTaiKhoanToLookupEdit();
            if (isAddNew)
            {
                fdoAdd();
            }
            else
            {
                BindData();
                SysPar.SetGridReadOnly(true, gvPhieuThuCT);
                setReadOnly(true);
            }

            Utils.closeWait(Dlg);
        }
Esempio n. 10
0
 private void PatientTableWithSearch_SearchCompleted(object sender, DTO.BenhNhanDTO e)
 {
     DevExpress.Utils.WaitDialogForm f = new DevExpress.Utils.WaitDialogForm();
     this.timer1.Tick += new EventHandler((s, er) =>
     {
         var interval = (DateTime.Now - this.time).TotalSeconds;
         if (!f.IsDisposed && interval > 5)
         {
             this.timer1.Stop();
             f.Close();
             MessageBox.Show("Không thể load dữ liệu", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     });
     this.timer1.Interval = 1000;
     this.time            = DateTime.Now;
     this.timer1.Start();
     this.searchBenhNhan(e, (listPatients, result) =>
     {
         f.Close();
         this.timer1.Stop();
         if (result.Equals(COM.Constant.RES_SUC))
         {
             this.table.fetchData(listPatients);
         }
         else
         {
             MessageBox.Show("Không tìm thấy kết quả phù hợp!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     });
 }
Esempio n. 11
0
        public void rptDM_SanPham()
        {
            try{
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In sản phẩm");

                rptDM_SanPham oReport = new  rptDM_SanPham();
                DataTable     otblRpt = new MTSQLServer().wRead("rptDM_SanPham", null, false);

                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();
                    setParameterInfo(oReport);
                    setFormatReport(oReport);
                    SetMarginReport(oReport, false, 30, 30, 30, 25);

                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;
                    oPreview.ShowDialog();
                }
                else
                {
                    Utils.showMessage("Không tìm thấy dữ liệu báo cáo..", "Thông báo");
                }

                Dlg.Close();
            }
            catch (Exception ex) { }
        }
Esempio n. 12
0
        public void rptCN_BaocaoCongnophaithuTH(DataTable otblRpt, String mNgaydau, String mNgaycuoi)
        {
            try
            {
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "Báo cáo bán hàng");

                rptCN_CanthuTH oReport = new rptCN_CanthuTH();
                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();
                    oReport.Parameters["parThangNam"].Value = String.Format("Từ ngày: {0}   đến ngày: {1} ", mNgaydau, mNgaycuoi);

                    setParameterInfo(oReport);
                    setFormatReport(oReport);
                    SetMarginReport(oReport, true, 30, 30, 30, 25);

                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;
                    oPreview.ShowDialog();
                }
                Dlg.Close();
            }
            catch (Exception ex) { }
        }
Esempio n. 13
0
        void refreshData()
        {
            DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү.");

            try
            {
                dlg.Show();

                command            = new SqlCommand();
                command.Connection = frmMain.conn;
                if (para != null)
                {
                    command.CommandText = "SELECT * FROM TBLAUTHOR WHERE " + para[1] + " ORDER BY CREATED DESC";
                }
                else
                {
                    command.CommandText = "SELECT * FROM TBLAUTHOR ORDER BY CREATED DESC";
                }
                command.CommandType = CommandType.Text;

                SqlDataReader dr = command.ExecuteReader();
                mainTable.Clear();
                mainTable.Load(dr);
                frmMain.dataTableColumnNameToUpper(mainTable);
                gridControl1.DataSource = mainTable;
                command.Dispose();

                dlg.Close();
            }
            catch (Exception ex)
            {
                dlg.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message);
            }
        }
Esempio n. 14
0
        private void PermitView_Load(object sender, EventArgs e)
        {
            this.btnClose.Left = this.Width - this.btnClose.Width - 30;
            this.btnOK.Left    = this.btnClose.Left - this.btnOK.Width - 10;
            roleGridEdit1.LoadData();
            treeCtl1.AfterCheckNode += treeCtl1_AfterCheckNode;
            treeCtl1.Enabled         = false;
            var menu = Db.FirstOrDefault <t_menu>(" where version='1.0'");
            //解析菜单Json
            var menus = ObjectHelper.DeSerialize <List <MenuData> >(menu.MenuJson);

            treeCtl1.ClearNodes();
            ExtractMenu(menus);
            dlg = new DevExpress.Utils.WaitDialogForm("正在加载权限设置信息 ...",
                                                      "数据加载中");
            var t = new Thread(() => {
                //加载菜单
                this.Invoke(new Action(() => {
                    BuildlRoleTree();
                    Visible = true;
                }));
                this.Invoke(new Action(() => dlg.Close()));
            });

            t.SetApartmentState(ApartmentState.STA);
            t.IsBackground = true;
            t.Start();
        }
Esempio n. 15
0
        public IEnumerable <Object> getAllUserByDepartment(Int64 id)
        {
            var dlg = new DevExpress.Utils.WaitDialogForm("Đang tải dữ liệu ...", "Thông báo");

            try{
                db.Dispose( );
                db = new DataClasses1DataContext( );
                db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues);

                var data = from b in db.ST_employees
                           where b.department_id == id
                           select b;

                if (data != null)
                {
                    return(data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                return(null);
            }
            finally{
                dlg.Close( );
            }
        }
Esempio n. 16
0
        public DM_BangGia()
        {
            InitializeComponent();
            MTButton.cmdAdd   = this.cmdAdd;
            MTButton.cmdEdit  = this.cmdEdit;
            MTButton.cmdDel   = this.cmdDel;
            MTButton.cmdSave  = this.cmdSave;
            MTButton.cmdAbort = this.cmdAbort;
            MTGlobal.SetFormatGridControl(grdBangGiaCT, tblViewCT);
            MTGlobal.SetFormatGridControl(grdBangGiaCT, tblViewBG);


            Dlg = Utils.shwWait();

            //LOAD PRODUCT GROUP
            //DataTable otblNhomSP = new MTSQLServer().wRead(SQL_PRODUCT_GROUP, null, false);
            //grdBangGia.ItemsSource = otblNhomSP;
            crud_BangGia = new CRUDHandling(grdBangGia, tblViewBG, colBanggia, MTROLE, MTButton, "DM_BANGGIA", "Banggiaid", CODE_NAME,
                                            CODE_HEADER, SQL_PRODUCT_GROUP, "");

            String err = crud_BangGia.GridForm_Loaded();

            MTGlobal.SetGridReadOnly(grdBangGia, tblViewBG, true);

            crud = new CRUDHandling(grdBangGiaCT, tblViewCT, colMasp, MTROLE, MTButton, TABLE_NAME, ID_NAME, CODE_NAME,
                                    CODE_HEADER, String.Format(SQL_LOAD_ALL_BGCT, mBangGiaId), SQL_DELETE_BGCT);

            System.Threading.Thread oThreSP = new System.Threading.Thread(LoadSanPham);
            oThreSP.Start();

            Utils.closeWait(Dlg);
        }
Esempio n. 17
0
        public CX_PhieuCX(String mPhieuID, String mLoaiPhieu, String mTuNgay, String mDenNgay, MTGlobal.MT_ROLE mActRole, bool isAddNew = false)
        {
            InitializeComponent();

            this.pPhieuID   = mPhieuID;
            this.pTuNgay    = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay;
            this.pDenNgay   = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay;
            this.pLoaiPhieu = mLoaiPhieu;
            this.pACT_ROLE  = mActRole;

            Dlg = Utils.shwWait();
            setUserRight();
            loadCustomerToLookupEdit();
            loadCarToLookupEdit();
            if (isAddNew)
            {
                fdoAdd();
            }
            else
            {
                BindData();
                SysPar.SetGridReadOnly(true, gvPhieu);
                setReadOnly(true);
            }
            System.Threading.Thread oThreSP = new System.Threading.Thread(LoadSanPham);
            oThreSP.Start();

            Utils.closeWait(Dlg);
        }
Esempio n. 18
0
        /// <summary>
        /// 查询事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckDate())
                {
                    DevExpress.Utils.WaitDialogForm m_WaitDialog = new DevExpress.Utils.WaitDialogForm("正在查询数据...", "请稍等");
                    InitializeButtonStatus();
                    string serachtype = string.Empty;
                    if (rdbtnInPat.Checked)
                    {
                        serachtype = "inhos";
                    }
                    if (rdbtnOutPat.Checked)
                    {
                        serachtype = "outhos";
                    }
                    LoadData(serachtype);


                    m_WaitDialog.Hide();
                }
            }
            catch (Exception ex)
            {
                MyMessageBox.Show(1, ex);
            }
        }
 private void btnDongY_Click(object sender, EventArgs e)
 {
     if (txtTenNguyenLieu.Text.Trim().Length == 0)
     {
         DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Tên Nguyên Liệu !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtTenNguyenLieu.Focus();
     }
     else
         if (txtDonVi.Text.Trim().Length == 0)
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập đơn vị nguyên liêu!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtDonVi.Focus();
         }
         else
         {
             _nguyenlieu.TenNL = txtTenNguyenLieu.Text.Trim();
             _nguyenlieu.DonVi = txtDonVi.Text.Trim();
             DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang thêm nguyên liệu mới ");
             frmWailt.LookAndFeel.SetSkinStyle("Seven Classic");
             frmWailt.Show();
             if (busNguyenLieu.InsertNguyenLieu(mode, NguyenLieu) == 1)
             {
                 frmWailt.Close();
                 DevExpress.XtraEditors.XtraMessageBox.Show("Thêm dử liệu thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 frmWailt.Close();
                 DevExpress.XtraEditors.XtraMessageBox.Show("Thêm dử liệu thất bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
 }
Esempio n. 20
0
        public void rptTC_Phieuchi(String mPhieunxid)
        {
            try
            {
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In phiếu nhập");

                rptTC_Phieuchi oReport = new rptTC_Phieuchi();
                SqlParameter[] arrPara = new SqlParameter[2];
                arrPara[0]       = new SqlParameter("@Phieutcid", SqlDbType.NVarChar, 50);
                arrPara[0].Value = mPhieunxid;
                arrPara[1]       = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[1].Value = MTGlobal.MT_USER_LOGIN;
                DataTable otblRpt = new MTSQLServer().wRead("rptTC_Phieuthuchi", arrPara);

                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();
                    setParameterInfo(oReport);
                    setFormatReport(oReport);
                    SetMarginReport(oReport, false, 30, 30, 30, 25);
                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;

                    oPreview.ShowDialog();
                }

                Dlg.Close();
            }
            catch (Exception ex) { }
        }
Esempio n. 21
0
        void refreshData()
        {
            DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү.");

            try
            {
                dlg.Show();

                command             = new SqlCommand();
                command.Connection  = frmMain.conn;
                command.CommandText = "SELECT TBLUSER.USERID, TBLUSER.ISACTIVE, TBLSTUDENT.LASTNAME, TBLSTUDENT.FIRSTNAME, TBLSTUDENT.CODE, TBLSTUDENT.MOBILEPHONE, TBLSTUDENT.EMAIL, Addr1 +' '+ Addr2 ADDRESS FROM TBLUSER LEFT JOIN TBLSTUDENT ON TBLSTUDENT.STUDENTID = TBLUSER.STUDENTID ORDER BY TBLUSER.CREATED";
                command.CommandType = CommandType.Text;

                SqlDataReader dr = command.ExecuteReader();
                mainTable.Clear();
                mainTable.Load(dr);
                frmMain.dataTableColumnNameToUpper(mainTable);
                gridControl1.DataSource = mainTable;
                command.Dispose();

                dlg.Close();
            }
            catch (Exception ex)
            {
                dlg.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message);
            }
        }
Esempio n. 22
0
        private void btnNhapHang_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang thêm phiếu nhập kho mới ");
            frmWailt.LookAndFeel.SetSkinStyle("Seven Classic");

            try
            {
                frmWailt.Show();
                if (busDatHang.UpdateTinhTrangDatHang(mode, lsDatHang[sttDH - 1].MaHoaDon, "Đã Giao") == 1)
                {
                    frmWailt.Close();
                    DevExpress.XtraEditors.XtraMessageBox.Show("Thêm phiếu nhập kho thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    frmWailt.Close();
                    DevExpress.XtraEditors.XtraMessageBox.Show("Thêm phiếu nhập khothất bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                frmWailt.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 23
0
        private void btnPrtPreView_Click(object sender, EventArgs e)
        {
            PrtPreView = true;
            PrintSession = Guid.NewGuid();
            var dlg = new DevExpress.Utils.WaitDialogForm("正在处理打印数据 ...",
             "正在打印");
            //打印单据
            var errflag = false;
            try {               //生成打印的数据
                if (errflag = GenData()) {
                    if (cmbPrtTemp.SelectedItem.ToString().Equals("标准模板")) {
                        //打印单据
                        DoStdPrint(PrtPreView);
                    } else if (cmbPrtTemp.SelectedItem.ToString().Equals("床垫模板")) {
                        DoCDPrint(PrtPreView);
                    }
                    SerNoCaller.Calr_OrderProced.ExecSql(" delete T_ERP_OrderProced where PrintSession=@0", PrintSession);

                }

            } catch (Exception) {
                RefreashPrintOrder();
                throw;
            } finally {
                dlg.Close();
            }
        }
Esempio n. 24
0
        static void Main( )
        {
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            DevExpress.Skins.SkinManager.EnableMdiFormSkins();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm();
            waiting.SetCaption("Connecting . . .!");
            waiting.Text = "";
            waiting.Show();

            if (DataQueryProvider.Connect() == false)
            {
                waiting.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show("Please check connection", "Auto generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DataQueryProvider.InitDataTables();

            Form1 form = new Form1();

            waiting.Close();

            Application.Run(form);
        }
Esempio n. 25
0
        public void ExecuteScript( )
        {
            if (ScriptTabControl.SelectedTabPage == null)
            {
                return;
            }

            Scintilla rtbScript = (Scintilla)ScriptTabControl.SelectedTabPage.Controls[0];
            String    stQuery   = rtbScript.Selection.Text.Trim();

            if (String.IsNullOrEmpty(stQuery))
            {
                stQuery = rtbScript.Text;
            }

            if (String.IsNullOrEmpty(stQuery))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm();
            waiting.SetCaption("Executing . . .!");
            waiting.Show();

            DataSet ds = DataQueryProvider.RunQuery(stQuery);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1)
            {
                ResultRichText.Text = ds.Tables[0].Rows[0][0].ToString();
            }

            waiting.Close();
            Cursor.Current = Cursors.Default;
        }
Esempio n. 26
0
 private void btnDongY_Click(object sender, EventArgs e)
 {
     if (txtTenNguyenLieu.Text.Trim().Length == 0)
     {
         DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Tên Nguyên Liệu !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtTenNguyenLieu.Focus();
     }
     else
     if (txtDonVi.Text.Trim().Length == 0)
     {
         DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập đơn vị nguyên liêu!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtDonVi.Focus();
     }
     else
     {
         _nguyenlieu.TenNL = txtTenNguyenLieu.Text.Trim();
         _nguyenlieu.DonVi = txtDonVi.Text.Trim();
         DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang thêm nguyên liệu mới ");
         frmWailt.LookAndFeel.SetSkinStyle("Seven Classic");
         frmWailt.Show();
         if (busNguyenLieu.InsertNguyenLieu(mode, NguyenLieu) == 1)
         {
             frmWailt.Close();
             DevExpress.XtraEditors.XtraMessageBox.Show("Thêm dử liệu thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             frmWailt.Close();
             DevExpress.XtraEditors.XtraMessageBox.Show("Thêm dử liệu thất bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Esempio n. 27
0
        public NX_PhieuXuat(String mPhieuNXID, String mLoaiPhieu, String mTuNgay, String mDenNgay, MTGlobal.MT_ROLE mActRole, bool isAddNew = false)
        {
            InitializeComponent();
            this.lblTitle.Text = "Phiếu xuất kho - " + MTGlobal.RPT_COMPANY;
            this.pPhieuNXID    = mPhieuNXID;
            this.pTuNgay       = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay;
            this.pDenNgay      = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay;
            this.pLoaiPhieu    = mLoaiPhieu;
            this.pACT_ROLE     = mActRole;

            Dlg = Utils.shwWait();
            setUserRight();
            loadWarehourseToLookupEdit();
            loadCustomerToLookupEdit();
            loadLydoToLookupEdit();
            if (isAddNew)
            {
                fdoAdd();
            }
            else
            {
                BindData();
                SysPar.SetGridReadOnly(true, gvPhieuXuat);
                setReadOnly(true);
            }

            System.Threading.Thread oThreSP = new System.Threading.Thread(LoadSanPham);
            oThreSP.Start();

            Utils.closeWait(Dlg);
        }
Esempio n. 28
0
        private void btnImp_Click(object sender, EventArgs e)
        {
            if (MsgBox.ShowYesNoMessage("确定要导入吗?") == System.Windows.Forms.DialogResult.No) return;
            var dlg = new DevExpress.Utils.WaitDialogForm("正在导入,请稍候...","导入");
            try {
                var ds = GridControl.GetDataSource<UltraDbEntity.T_ERP_ItemPrice_Impt>();
                if (null == ds || ds.Count < 1) return;
                //var gid = Guid.NewGuid();
                ds.ForEach(j => {
                    j.Guid = Guid.NewGuid();
                    j.Updator = j.Creator = CurUser;

                    j.Reserved1 = 0; j.Reserved2 = string.Empty; j.Remark = string.Empty; j.Reserved3 = false;
                });
                var rd = SerNoCaller.Calr_ItemPrice_Impt.Add(ds);
                if (!rd.IsOK) {
                    MsgBox.ShowErrMsg(rd.ErrMsg); return;
                }

                //执行同步
                SerNoCaller.Calr_ItemPrice_Impt.ExecSql("exec P_FAS_SyncItemPriceImpt");

            } catch (Exception) {

                throw;
            } finally {
                dlg.Close();
            }
            MsgBox.ShowMessage("导入已完成!");
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Esempio n. 29
0
        private void btnQueryPrograms_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string CreatorName = this.bItemUserName.EditValue.ToString().Trim();

            if (CreatorName == null || CreatorName.Length <= 0)
            {
                XtraMessageBox.Show("请输入用户名!", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            gcPrograms.DataSource = null;
            UserInfo _UserInfo = GetUserInfoByLoginName(CreatorName);

            if (_UserInfo != null)
            {
                DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("用户:" + CreatorName + " 的节目", "正在查询", new Size(150, 50), this);
                DataTable dt = GetProgramsByCreatorUserID(_UserInfo.UserID);
                gcPrograms.DataSource = dt;
                dlg.Close();
                if (dt != null && dt.Rows.Count > 0)
                {
                    lblQueryInfo.Visibility = BarItemVisibility.Always;
                    lblQueryInfo.Caption    = "用户:" + _UserInfo.UserName + "(" + _UserInfo.FullName + ") 的节目数量为" + dt.Rows.Count;
                }
                else
                {
                    lblQueryInfo.Visibility = BarItemVisibility.Never;
                }
            }
            else
            {
                lblQueryInfo.Visibility = BarItemVisibility.Never;
                XtraMessageBox.Show("未找到用户:" + this.bItemUserName.EditValue.ToString().Trim(), "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 30
0
        public void rptTL_DiemTichLuy(int isChiTiet, DataTable tblKH)
        {
            try
            {
                DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "In điểm tích lũy chi tiết");

                rptTL_DiemTichLuy oReport = new rptTL_DiemTichLuy();
                SqlParameter[]    arrPara = new SqlParameter[2];
                arrPara[0]       = new SqlParameter("@isChiTiet", SqlDbType.Int);
                arrPara[0].Value = 1;
                arrPara[1]       = new SqlParameter("@tblMADT", SqlDbType.Structured);
                arrPara[1].Value = tblKH;

                DataTable otblRpt = new MTSQLServer().wRead("rptTL_TongDiemTL", arrPara);

                Dlg.Close();
                if (otblRpt != null)
                {
                    oReport.DataSource = otblRpt;
                    oReport.BindData();
                    setParameterInfo(oReport);
                    setFormatReport(oReport);
                    SetMarginReport(oReport, true, 30, 30, 30, 25);
                    PrintPreview oPreview = new PrintPreview();
                    oPreview.report = oReport;

                    oPreview.ShowDialog();
                }

                Dlg.Close();
            }
            catch (Exception ex) { }
        }
Esempio n. 31
0
 private void PermitView_Load(object sender, EventArgs e) {
     this.btnClose.Left = this.Width - this.btnClose.Width - 30;
     this.btnOK.Left = this.btnClose.Left - this.btnOK.Width - 10;
     roleGridEdit1.LoadData();
     treeCtl1.AfterCheckNode += treeCtl1_AfterCheckNode;
     treeCtl1.Enabled = false;
     var menu = Db.FirstOrDefault<t_menu>(" where version='1.0'");
     //解析菜单Json
     var menus = ObjectHelper.DeSerialize<List<MenuData>>(menu.MenuJson);
     treeCtl1.ClearNodes();
     ExtractMenu(menus);
     dlg = new DevExpress.Utils.WaitDialogForm("正在加载权限设置信息 ...",
         "数据加载中");
     var t = new Thread(() => {
         //加载菜单
         this.Invoke(new Action(() => {
             BuildlRoleTree();
             Visible = true;
         }));
         this.Invoke(new Action(() => dlg.Close()));
     });
     t.SetApartmentState(ApartmentState.STA);
     t.IsBackground = true;
     t.Start();
 }
Esempio n. 32
0
        public void BarManager_ItemClick(object sender, EventArgs e)
        {
            DevExpress.Utils.WaitDialogForm WaitDialogForm = new DevExpress.Utils.WaitDialogForm();

            string formName = "";
            string formText = "";

            if (e.GetType() == typeof(DevExpress.XtraNavBar.NavBarLinkEventArgs))
            {
                formName = ((DevExpress.XtraNavBar.NavBarLinkEventArgs)e).Link.ItemName;
                formText = ((DevExpress.XtraNavBar.NavBarLinkEventArgs)e).Link.Caption;
            }
            else
            if (e.GetType() == typeof(DevExpress.XtraBars.ItemClickEventArgs))
            {
                formName = ((DevExpress.XtraBars.ItemClickEventArgs)e).Item.Name;
                formText = ((DevExpress.XtraBars.ItemClickEventArgs)e).Item.Caption;
            }
            else
            {
                formName = ((System.Windows.Forms.Control)sender).Name;
                formText = ((System.Windows.Forms.Control)sender).Text;
            }
            //switch (formName)
            //{

            //}
            WaitDialogForm.Close();
        }
Esempio n. 33
0
        public CX_PhieuCX(String mPhieuID, String mLoaiPhieu, String mTuNgay, String mDenNgay, MTGlobal.MT_ROLE mActRole, bool isAddNew = false)
        {
            InitializeComponent();

            this.lblTitle.Content = "LÂP PHIẾU GỬI CHÀNH";
            this.pPhieuID         = mPhieuID;
            this.pTuNgay          = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay;
            this.pDenNgay         = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay;
            this.pLoaiPhieu       = mLoaiPhieu;
            this.pACT_ROLE        = mActRole;

            Dlg = Utils.shwWait();
            setUserRight();
            if (isAddNew)
            {
                fdoAdd();
            }
            else
            {
                BindData();
                MTGlobal.SetGridReadOnly(grdPhieu, tblView, true);
                setReadOnly(true);
            }
            System.Threading.Thread oThreSP = new System.Threading.Thread(LoadSanPham);
            oThreSP.Start();

            Utils.closeWait(Dlg);
        }
Esempio n. 34
0
        public void BarManager_ItemClick(object sender, EventArgs e)
        {
            DevExpress.Utils.WaitDialogForm WaitDialogForm = new DevExpress.Utils.WaitDialogForm();

            string formName = "";
            string formText = "";

            if (e.GetType() == typeof(DevExpress.XtraNavBar.NavBarLinkEventArgs))
            {
                formName = ((DevExpress.XtraNavBar.NavBarItem)sender).Name;
                formText = ((DevExpress.XtraNavBar.NavBarItem)sender).Caption;
            }
            else if (e.GetType() == typeof(DevExpress.XtraBars.ItemClickEventArgs))
            {
                formName = ((DevExpress.XtraBars.ItemClickEventArgs)e).Item.Name;
                formText = ((DevExpress.XtraBars.ItemClickEventArgs)e).Item.Caption;
            }

            switch (formName)
            {
            case "FrmControlPanel":
                FrmControlPanel = (Forms.FrmControlPanel)itvs.Windows.MdiUtils.MdiChecker.GetMdiChilden(mdiParent, "FrmControlPanel");

                if (FrmControlPanel == null || FrmControlPanel.IsDisposed)
                {
                    FrmControlPanel = new Forms.FrmControlPanel();
                }
                FrmControlPanel.Text      = formText;
                FrmControlPanel.MdiParent = mdiParent;
                FrmControlPanel.Show();
                FrmControlPanel.Activate();
                break;
            }
            WaitDialogForm.Close();
        }
Esempio n. 35
0
 private void AddLargedataAnalysis_Load(object sender, EventArgs e)
 {
     DevExpress.Utils.WaitDialogForm wdf = new DevExpress.Utils.WaitDialogForm("正在打开大数据分析模型编辑窗体...", "请等待...");
     // 初始化窗体
     LoadForm(largedataAnalysisId);
     wdf.Close();
 }
Esempio n. 36
0
        private void btnImp_Click(object sender, EventArgs e)
        {
            if (MsgBox.ShowYesNoMessage("确定要导入吗?") == System.Windows.Forms.DialogResult.No) return;
            var dlg = new DevExpress.Utils.WaitDialogForm("正在导入,请稍候...","导入");
            try {
                var ds = GridControl.GetDataSource<T_ERP_ProduceDosageIpt>();
                if (null == ds || ds.Count < 1) return;
                var session = Guid.NewGuid();
                List<T_ERP_ProduceDosageIptTemp> ipts = new List<T_ERP_ProduceDosageIptTemp>();
                ds.ForEach(j => {
                    var ipt = new T_ERP_ProduceDosageIptTemp
                    {
                        Session = session,
                        OuterIid = j.OuterIid,
                        OuterSkuId = j.OuterSkuId,
                        ProcedureName = j.ProcedureName,
                        MaterialNo = j.MaterialNo,
                        MaterialName = j.MaterialName,
                        Dosage = j.Dosage,
                        Unit = j.Unit
                    };
                    ipts.Add(ipt);
                });

                using (SqlConnection destinationConnection = new SqlConnection(this.ConnString))
                {
                    destinationConnection.Open();
                    using (SqlBulkCopy bulkCopy =
                               new SqlBulkCopy(destinationConnection))
                    {
                        bulkCopy.DestinationTableName = "T_ERP_ProduceDosageIpt";
                        try
                        {
                            bulkCopy.WriteToServerAdv(ipts);
                        }
                        catch (Exception ex)
                        {
                            MsgBox.ShowErrMsg("导入失败;错误信息:" + ex.Message);
                            return;
                        }
                    }
                }

                //导入成功,调用迁移过程
                var prms = new SqlParameter[]{
                            new SqlParameter("@session", session),
                            new SqlParameter("@user", this.CurUser)
                        };
                SqlHelper.ExecuteNonQuery(this.ConnString, CommandType.StoredProcedure, "P_FAS_ProduceDosageImpt", prms);
            } catch (Exception) {
                throw;
            } finally {
                dlg.Close();
            }
            MsgBox.ShowMessage("导入已完成!");
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
        private void btnNhapHang_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang thêm phiếu nhập kho mới ");
            frmWailt.LookAndFeel.SetSkinStyle("Seven Classic");

            try
            {
                frmWailt.Show();
                if (busDatHang.UpdateTinhTrangDatHang(mode, lsDatHang[sttDH - 1].MaHoaDon, "Đã Giao") == 1)
                {
                    frmWailt.Close();
                    DevExpress.XtraEditors.XtraMessageBox.Show("Thêm phiếu nhập kho thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    frmWailt.Close();
                    DevExpress.XtraEditors.XtraMessageBox.Show("Thêm phiếu nhập khothất bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                frmWailt.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
Esempio n. 38
0
 private void btnPrt_Click(object sender, EventArgs e)
 {
     PrtPreView = false;
     PrintSession = Guid.NewGuid();
     var dlg = new DevExpress.Utils.WaitDialogForm("正在处理打印数据 ...",
      "正在打印");
     //打印单据
     var errflag = false;
     try {               //生成打印的数据
         if (errflag = GenData()) {
             if (cmbPrtTemp.SelectedItem.ToString().Equals("标准模板")) {
                 //打印单据
                 DoStdPrint(PrtPreView);
             } else if (cmbPrtTemp.SelectedItem.ToString().Equals("床垫模板")) {
                 DoCDPrint(PrtPreView);
             }
         }
     } catch (Exception) {
         RefreashPrintOrder();
         throw;
     } finally {
         dlg.Close();
     }
     if (errflag) {
         RefreashPrintOrder();
         MsgBox.ShowMessage("打印完成!");
     }
 }
Esempio n. 39
0
        private void fileBrowser1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var dc = DicKF;
            if (null == DicKF) return;
            //读取文件数据
            var dlg = new DevExpress.Utils.WaitDialogForm("正在加载数据,请稍候...", "导入");
            try {
                var ipitm = XlsCommon.Read<T_ERP_ProduceDosageIpt>(fileBrowser1.Text, DicKF);
                this.GridControl.DataSource = ipitm;
            } catch (Exception) {

                throw;
            } finally {
                dlg.Close();
            }
        }
Esempio n. 40
0
        public void XoaNhaCungCap()
        {
            if (DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có chắc là xóa nhà cung cấp này không", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //try
                    //{
                        DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm();
                        frmWailt.Caption = " Đang cập nhật dữ liệu ! ";
                        frmWailt.Show();
                        int result = busNhaCungCap.DeleteNhaCungCap(mode, lsNCC[indexNCC].MaNCC);
                        frmWailt.Close();
                        if (result == 1)
                        {
                            LoadNhaCungCap();

                            DevExpress.XtraEditors.XtraMessageBox.Show("Đã xóa nhà cung cấp", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                            if (result == -1)
                                DevExpress.XtraEditors.XtraMessageBox.Show("Không thể xóa nhà cung cấp này \n Ghi chú :không thể xóa nhà cung cấp khi thông tin nhà cung cấp được sử dụng trong đơn đặt hàng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            else
                                DevExpress.XtraEditors.XtraMessageBox.Show("Xóa  nhà cung cấp thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //}
                    //catch (Exception)
                    //{
                    //    DevExpress.XtraEditors.XtraMessageBox.Show("Xóa nhà cung cấp thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //}
                }
        }
Esempio n. 41
0
 public void CapNhatNhaCungCap()
 {
     frmNhaCungCap_Them_CapNhat _frm = new frmNhaCungCap_Them_CapNhat();
         _frm.Flag = 2;
         _frm.MaNH = maNH;
         _frm.DtoNCC = lsNCC[indexNCC];
         _frm.Mode = mode;
         if (_frm.ShowDialog() == DialogResult.OK)
         {
             DataTable dtNguyenLieu = _frm.DtNguyenLieuChon;
             VNhaCungCap_DTO dtoNCC = _frm.DtoNCC;
             DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm(""," Đang Cập Nhật Thông Tin Nhà Cung Cấp ");
             frmWailt.LookAndFeel.SetSkinStyle("Seven Classic");
             try
             {
                 frmWailt.Show();
                 int result = busNhaCungCap.UpdatetNhaCungCap(mode, _frm.DtoNCC, _frm.DtChiTietNCC);
                 if (result == 0)
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     frmWailt.Close();
                     LoadNhaCungCap();
                     LoadNguyenLieu(lsNCC[sttNCC - 1].MaNCC);
                     DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             catch (Exception)
             {
                 frmWailt.Close();
                 DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
 }
Esempio n. 42
0
        private void btnThucHien_Click(object sender, EventArgs e)
        {
            if (checkAllowUpdate() == false) return;

            DevExpress.Utils.WaitDialogForm wait = null;
            try
            {
                this.btnThoat.Enabled = false;
                #region Lấy thông tin local version
                int localVersion = -1;
                if (FrameworkParams.IsUpdateVersionAtLocalServer)
                {
                    localVersion = LiveUpdateHelper.getVersionFromCustomerServer();
                    if (localVersion == -1)
                    {
                        LiveUpdateHelper.initDataStructure();
                        localVersion = 0;
                    }
                }
                else
                {
                    localVersion = LiveUpdateHelper.getLocalhostVersion();
                }
                #endregion

                #region Lấy thông tin newVersion
                int newVersion = -1;
                if (!rdoURL.Checked)
                    newVersion = LiveUpdateHelper.getVersionFromZipFile(btnEditFileDuLieu.EditValue.ToString());
                else
                    newVersion = LiveUpdateHelper.getVersionFromProtocolServer();

                if (newVersion == -1)
                {
                    HelpMsgBox.ShowNotificationMessage("Có lỗi trong quá trình cập nhật. \n Vui lòng thử lại sau.");
                    return;
                }
                #endregion

                #region Kiểm tra nếu có phiên bản mới hay ko
                if (localVersion < newVersion)
                {
                    if (FrameworkParams.IsUpdateVersionAtLocalServer == false)
                    {
                        if (PLMessageBox.ShowConfirmMessage(this.thongBaoHoiCoCapNhatMoi) != DialogResult.Yes)
                        {
                            return;
                        }
                    }
                    else
                    {
                        //Cập nhật thẳng không hỏi ???
                    }
                }
                else if (localVersion == newVersion)
                {
                    HelpMsgBox.ShowNotificationMessage("Phiên bản phần mềm đang sử dụng là mới nhất.");
                    return;
                }
                else
                {
                    if(PLMessageBox.ShowConfirmMessage(this.thongBaoHoiCoCapNhatCu) != DialogResult.Yes)
                    {
                        return;
                    }
                    return;
                }
                #endregion

                #region Lấy dữ liệu cập nhật (từ HTTP SERVER || Từ localfile)
                wait = new DevExpress.Utils.WaitDialogForm("Đang xử lý ...", "");
                //Nếu URL != null thì sẽ lấy dữ liệu từ URL về máy cục bộ thông qua giao thức HTTP
                if (this.rdoURL.Checked)
                {
                    String URL = LiveUpdateHelper.getVersionURLFromProtocolServer();
                    //Quá trình download tập tin từ mạng
                    if (!downloadFileFromURL(URL))
                    {
                        //wait.Close();
                        HelpMsgBox.ShowNotificationMessage("Có lỗi trong quá trình cập nhật. \n Vui lòng thử lại sau.");
                        return;
                    }
                }
                else
                {
                    //Quá trình download tập tin từ cục bộ
                }

                #endregion

                #region Cập nhật phiên bản mới vào máy chủ Nội bộ
                if (FrameworkParams.IsUpdateVersionAtLocalServer)
                {
                    FileStream fileReader = null;
                    if (!rdoURL.Checked)
                        fileReader = new FileStream(btnEditFileDuLieu.EditValue.ToString(), FileMode.Open, FileAccess.Read);
                    else
                        fileReader = new FileStream(zipFilePath, FileMode.Open, FileAccess.Read);

                    byte[] fileByte = new byte[(int)fileReader.Length];
                    fileReader.Read(fileByte, 0, System.Convert.ToInt32(fileReader.Length));
                    fileReader.Flush();
                    fileReader.Close();

                    DatabaseFB db = DABase.getDatabase();
                    DbCommand command = DABase.getDatabase().GetSQLStringCommand("UPDATE FW_LIVE_UPDATE SET FILECONTENT = @file, VERSION = @newversion WHERE ID=1");
                    db.AddInParameter(command, "@newversion", DbType.Int16, newVersion);
                    db.AddInParameter(command, "@file", DbType.Binary, fileByte);

                    if (db.ExecuteNonQuery(command) == 0)
                    {
                        db = DABase.getDatabase();
                        command = DABase.getDatabase().GetSQLStringCommand("INSERT INTO FW_LIVE_UPDATE VALUES(1, @file, @newversion)");
                        db.AddInParameter(command, "@newversion", DbType.Int16, newVersion);
                        db.AddInParameter(command, "@file", DbType.Binary, fileByte);
                        db.ExecuteNonQuery(command);
                    }
                }
                #endregion

                #region Cập nhật vào Localhost
                else
                {
                    if (!rdoURL.Checked)
                    {
                        if (File.Exists(LiveUpdateHelper.UPDATE_DOWNLOAD_VERSION_ZIP_FILE))
                        {
                            File.Delete(LiveUpdateHelper.UPDATE_DOWNLOAD_VERSION_ZIP_FILE);
                        }

                        if (Directory.Exists(LiveUpdateHelper.UPDATE_DOWNLOAD_FOLDER) == false)
                            Directory.CreateDirectory(LiveUpdateHelper.UPDATE_DOWNLOAD_FOLDER);

                        File.Copy(btnEditFileDuLieu.EditValue.ToString(),
                            LiveUpdateHelper.UPDATE_DOWNLOAD_VERSION_ZIP_FILE);
                    }
                }
                #endregion
                if (FrameworkParams.IsUpdateVersionAtLocalServer == true)
                {
                    HelpMsgBox.ShowNotificationMessage("Đã cập nhật thành công. \nVui lòng cập nhật phiên bản mới từ máy chủ nội bộ.");
                }
                else
                {
                    LiveUpdateHelper.updateNewVersionHelper(FrameworkParams.IsUpdateVersionAtLocalServer, "" + newVersion);
                }
            }
            catch (Exception ex)
            {
                HelpMsgBox.ShowNotificationMessage("Có lỗi trong quá trình cập nhật. \nVui lòng thử lại sau.");
            }
            finally
            {
                if(wait != null ) wait.Close();
                btnCapNhat.Enabled = false;
                btnThoat.Enabled = true;
            }
        }
        public void LoadDuLieu()
        {
            DataSet temp = new DataSet();
                DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...","Đang Load Dử liệu ");
                frmWailt.LookAndFeel.SetSkinStyle("Seven Classic");
                frmWailt.Show();
                temp = busNguyenLieu.SelectNguyenLieu_NCC(mode, dtoNCC.MaNCC, maNH);
                frmWailt.Close();
                dtNguyenLieuChon_Source = temp.Tables[0];
                DtNguyenLieu = temp.Tables[1];

                Load_lvNguyenLieuChon();
                Load_lvNguyenLieu();
        }
Esempio n. 44
0
        /// <summary>
        /// 数据表格打印预览
        /// </summary>
        /// <param name="ListGrid">数据表格</param>
        /// <param name="strHead">表头显示信息</param>
        public static void PrintView(DevExpress.XtraGrid.GridControl ListGrid,DevExpress.XtraGrid.Views.Grid.GridView gridView, string strHead)
        {
            Cursor currentCursor = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;
            //"Report file creating","Read Data, Please waiting..."
            DevExpress.Utils.WaitDialogForm frmWait = new DevExpress.Utils.WaitDialogForm("正在获取数据,请稍候...", "表格报表");
            frmWait.Show();

            //以下以前的一种用法,现在改为可加上表头信息的印方式
            //if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable)
            //    DevExpress.XtraPrinting.PrintHelper.ShowPreview(ListGrid);

            //else
            //    //"XtraPrinting Library is not found..."
            //    DevExpress.XtraEditors.XtraMessageBox.Show(common.GetLanguageWord("MESSAGE", "M0028"), "", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //以下为采用新的打印方式
            string middleColumn = strHead;
            string rightColumn = string.Format("打印时间:{0:g}", DateTime.Now);
            PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());


            PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter;

            phf.Header.Content.Clear();
            phf.Header.Font = new Font("宋体", 12, FontStyle.Bold);

            phf.Header.Content.AddRange(new string[] { "打印用户:" + Common._personname, middleColumn, rightColumn });
            phf.Footer.Content.AddRange(new string[] { "", "页次[页 #/#]", "" });

            gridView.OptionsPrint.AutoWidth = false;    //<- 2012-09-18 add

            link.Component = ListGrid;
           


            //link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea);
          
            DevExpress.LookAndFeel.UserLookAndFeel lookfeel = new DevExpress.LookAndFeel.UserLookAndFeel(ListGrid);
            lookfeel.ParentLookAndFeel = ListGrid.LookAndFeel;
            PrintingSystem printSystem = new PrintingSystem();
            PrinterSettingsUsing pst = new PrinterSettingsUsing();
            pst.UseMargins = true;
            pst.UsePaperKind = true;
            printSystem.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
            printSystem.PageSettings.PaperName = "A4";
            printSystem.PageSettings.LeftMargin = 1;
            printSystem.PageSettings.RightMargin = 1;
            printSystem.PageSettings.Landscape = true;
            printSystem.PageSettings.AssignDefaultPrinterSettings(pst);
            link.PaperKind = printSystem.PageSettings.PaperKind;
            link.Margins = printSystem.PageSettings.Margins;
            link.Landscape = printSystem.PageSettings.Landscape;
            link.CreateDocument();
            link.ShowPreview(lookfeel);

            Cursor.Current = currentCursor;
            frmWait.Dispose();
            frmWait = null;
        }
Esempio n. 45
0
        private void fileBrowser1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (null == FieldsMapper)
                return;

            var filedlg = new OpenFileDialog();
            filedlg.Filter = this.FileFilter;
            if (filedlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                fileBrowser1.Text = filedlg.FileName;
                //读取文件数据
                var dlg = new DevExpress.Utils.WaitDialogForm("正在加载数据,请稍候...", "导入");
                try {
                    var ipitm = ExcelCommon.ReadXls<t_item>(fileBrowser1.Text, FieldsMapper);
                    this.GridControl.DataSource = ipitm;
                } catch (Exception) {

                    throw;
                } finally {
                    dlg.Close();
                }
            }
        }
Esempio n. 46
0
        private void PermitView_Load(object sender, EventArgs e)
        {
            this.btnClose.Left = this.Width - this.btnClose.Width - 30;
            this.btnOK.Left = this.btnClose.Left - this.btnOK.Width - 10;
            roleGridEdit1.LoadData();
            treeCtl1.AfterCheckNode += treeCtl1_AfterCheckNode; treeCtl1.Enabled = false;
            t_menu mnu;
            using (var db = new Database())
            {
                mnu = db.FirstOrDefault<t_menu>("select * from t_menu");
                //解析菜单XML
                treeCtl1.ClearNodes();
                ExtractMenu(mnu.MenuXml);
            }
            dlg = new DevExpress.Utils.WaitDialogForm("正在加载权限设置信息 ...",
                "数据加载中");

            var t = new Thread(() =>
            {
                //加载菜单
                this.Invoke(new Action(() =>
                {
                    BuildlRoleTree(); Visible = true;
                }));
                this.Invoke(new Action(() => dlg.Close()));
            });
            t.SetApartmentState(ApartmentState.STA);
            t.IsBackground = true;
            t.Start();
        }
Esempio n. 47
0
 /// <summary>
 /// Tạo WaitDialog
 /// </summary>
 public void CreateWaitDialog()
 {
     _dlg = new DevExpress.Utils.WaitDialogForm("Xin vui lòng chờ đợi");
 }
Esempio n. 48
0
        private void EdtView_Load(object sender, EventArgs e)
        {
            treeCtl1.Enabled = false;
            gtRole.Properties.DataSource = SerNoCaller_WL.Calr_Role.Get("where IsDel=0");

            dlg = new DevExpress.Utils.WaitDialogForm("正在加载权限设置信息 ...",
              "数据加载中");

            if (IsNewMenu) {
                var t = new Thread(() => {
                    this.Invoke(new Action(() => {
                        ExtractMenuNew();
                        BuildlRoleTree();
                        Visible = true;
                    }));
                });
                this.Invoke(new Action(() => dlg.Close()));
                t.SetApartmentState(ApartmentState.STA);
                t.IsBackground = true;
                t.Start();
            } else {
                var t = new Thread(() => {
                _redo:
                    var mnu = this.Cacher.Get<string>("SYS.Menu");
                    var rolexml = Lanucher.Cache.Get<string>("Ultra.KY.RS");
                    bool donerolexml = !string.IsNullOrEmpty(rolexml);
                    if (!donerolexml) {
                        Thread.Sleep(800);
                        goto _redo;
                    }

                    //加载菜单
                    this.Invoke(new Action(() => {
                        ExtractMenu(mnu);
                        BuildlRoleTree();
                        //treeCtl1.ImportFromXml(rolexml);
                        Visible = true;
                    }));
                    this.Invoke(new Action(() => dlg.Close()));
                });
                t.SetApartmentState(ApartmentState.STA);
                t.IsBackground = true;
                t.Start();
            }
        }