예제 #1
0
        public static void ShowMessage(string message, MessageType type, bool is_code = false)
        {
            string         title = "";
            MessageBoxIcon icon  = MessageBoxIcon.Error;

            if (is_code)
            {
                message = LanguageEngine.GetMessageCaption(message, ConfigEngine.Language);
            }
            switch (type)
            {
            case MessageType.Error:
                title = "ERROR_TITLE_CAPTION";
                icon  = MessageBoxIcon.Error;
                break;

            case MessageType.Success:
                title = "MESSAGE_TITLE_CAPTION";
                icon  = MessageBoxIcon.Information;
                break;

            case MessageType.Warning:
                title = "ERROR_SYSTEM_TITLE_CAPTION";
                icon  = MessageBoxIcon.Warning;
                break;
            }
            title = LanguageEngine.GetMessageCaption(title, ConfigEngine.Language);
            if (type == 0)
            {
                logger.Error(message);
            }
            XtraMessageBox.Show(message, title, MessageBoxButtons.OK, icon);
        }
예제 #2
0
 private void Initialize()
 {
     LanguageEngine.ChangeCaptionLayoutControlGroup(this.Name, ConfigEngine.Language, logDetail);
     LanguageEngine.ChangeCaptionSimpleButton(this.Name, ConfigEngine.Language, new SimpleButton[] { btnSaveClose, btnSaveInsert, btnCancel });
     LanguageEngine.ChangeCaptionLayoutControlItem(this.Name, ConfigEngine.Language, new DevExpress.XtraLayout.LayoutControlItem[] { lciGroupCode, lciVNName, lciENName, lciNote });
     LanguageEngine.ChangeCaptionCheckEdit(this.Name, ConfigEngine.Language, new CheckEdit[] { chkIsDefault, chkActive });
 }
예제 #3
0
        public static void OpenInputForm(XtraUserControl uc, Size size, bool isEdit)
        {
            frmOpen frm  = new frmOpen();
            string  temp = "";

            if (isEdit)
            {
                temp = (ConfigEngine.Language == "vi") ? "Cập Nhật" : "Update";
            }
            else
            {
                temp = (ConfigEngine.Language == "vi") ? "Thêm Mới" : "Add New";
            }
            frm.Text = string.Format("{0} {1}", temp, LanguageEngine.GetOpenFormText(uc.Name, ConfigEngine.Language));

            if (ConfigEngine.TouchMode)
            {
                int      width = 0, height = 0;
                string[] tmp = CaptionEngine.GetControlCaption(uc.Name, null, BaseConstant.FORM_SIZE, null).Split('|');
                width  = Convert.ToInt32(tmp[0]);
                height = Convert.ToInt32(tmp[1]);
                size   = new Size(width, height);
            }
            frm.Size        = size;
            frm.MaximumSize = size;
            frm.MinimumSize = size;

            frm.Controls.Clear();
            uc.Dock = DockStyle.Fill;
            frm.Controls.Add(uc);
            uc.Show();
            frm.ShowDialog();
        }
예제 #4
0
        private bool CheckValidate()
        {
            if (txtGroupCode.Text.Equals(""))
            {
                depError.SetError(txtGroupCode, LanguageEngine.GetMessageCaption("000003", ConfigEngine.Language));
                txtGroupCode.Focus();
                return(false);
            }
            if (txtGroupCode.Text.Contains(" "))
            {
                depError.SetError(txtGroupCode, LanguageEngine.GetMessageCaption("000004", ConfigEngine.Language));
                txtGroupCode.Focus();
                return(false);
            }
            if (CommonEngine.CheckExistsUnicodeChar(txtGroupCode.Text))
            {
                depError.SetError(txtGroupCode, LanguageEngine.GetMessageCaption("000021", ConfigEngine.Language));
                txtGroupCode.Focus();
                return(false);
            }
            if (txtVNName.Text.Trim().Equals(""))
            {
                depError.SetError(txtVNName, LanguageEngine.GetMessageCaption("000003", ConfigEngine.Language));
                txtVNName.Focus();
                return(false);
            }
            if (txtENName.Text.Trim().Equals(""))
            {
                depError.SetError(txtENName, LanguageEngine.GetMessageCaption("000003", ConfigEngine.Language));
                txtENName.Focus();
                return(false);
            }

            return(true);
        }
예제 #5
0
        public static string SaveExportCustom(Excel.Workbook Book, string report_name, bool isXlsFormat = false)
        {
            object Missing = System.Reflection.Missing.Value;
            string str     = "";

            try
            {
                report_name = report_name.Remove(report_name.LastIndexOf('.'));

                SaveFileDialog sDialog = new SaveFileDialog();
                str                      = string.Format(@"{0}_{1}_{2}", report_name, DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"), DateTime.Now.Ticks);
                sDialog.Filter           = isXlsFormat ? "Microsoft Excel (*.xls)|*.xls" : "Microsoft Excel 2007 (*.xlsx)|*.xlsx";
                sDialog.Title            = LanguageEngine.GetMessageCaption("000007", ConfigEngine.Language);
                sDialog.InitialDirectory = Temp;
                sDialog.FileName         = str;
                if (sDialog.ShowDialog() == DialogResult.OK)
                {
                    str = sDialog.FileName;
                    Book.SaveAs(str, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault, Missing, Missing, Missing, Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Missing, Missing, Missing, Missing, Missing);
                    CommonEngine.ShowMessage(ConfigEngine.Language.Equals("vi") ? "Tải tập tin mẫu thành công!" : "Download template success!", MessageType.Success);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return(str);
        }
예제 #6
0
        private void ChangeCaptionLanguage(string language)
        {
            LanguageEngine.ChangeTextRibbonForm(this, language);
            LanguageEngine.ChangeCaptionRibbonPage(this.Name, language, new DevExpress.XtraBars.Ribbon.RibbonPage[] { ribSystemModule, ribProductModule });
            LanguageEngine.ChangeCaptionRibbonPageGroup(this.Name, language, new DevExpress.XtraBars.Ribbon.RibbonPageGroup[] { ribSystemPage, ribUserPermissionPage, ribDatabasePage });
            LanguageEngine.ChangeCaptionBarButtonItem(this.Name, language, new BarButtonItem[] { btnShutdown, btnRestart, btnLockScreen, btnGroupUserList, btnUserList, btnPermission, btnChangePassword, btnBackupDatabase, btnRestoreDatabase, btnRefineDatabase });

            lblSystemDateValue.Caption = string.Format("<b><color=RED>{0}</color></b>", CommonEngine.SystemDateTime.ToString(ConfigEngine.DateFormat));
            lblSystemTimeValue.Caption = string.Format("<b><color=RED>{0}</color></b>", CommonEngine.SystemDateTime.ToString(ConfigEngine.TimeFormat));
        }
예제 #7
0
        private async Task <bool> CheckLogin()
        {
            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                CommonEngine.ShowMessage(LanguageEngine.GetMessageCaption("000011", ConfigEngine.Language), MessageType.Error);
                txtUsername.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                CommonEngine.ShowMessage(LanguageEngine.GetMessageCaption("000011", ConfigEngine.Language), MessageType.Error);
                txtPassword.Focus();
                return(false);
            }
            try
            {
                SYS_tblUserDRO user = await UserBUS.CheckLogin(txtUsername.Text.Trim(), EncryptEngine.Encrypt(txtPassword.Text.Trim()), ConfigEngine.Language);

                if (CommonEngine.CheckValidResponseItem(user.ResponseItem))
                {
                    if (user.UserItem != null)
                    {
                        CommonEngine.userInfo = user.UserItem;
                        string temp = user.UserItem.Username.Substring(user.UserItem.Username.IndexOf("|") + 1);
                        user.UserItem.Username      = user.UserItem.Username.Replace("|" + temp, "");
                        CommonEngine.SystemDateTime = Convert.ToDateTime(temp);

                        if (user.UserItem.Locked)
                        {
                            CommonEngine.ShowMessage(LanguageEngine.GetMessageCaption("000010", ConfigEngine.Language).Replace("$UserName$", user.UserItem.Username), MessageType.Error);
                            txtUsername.Focus();
                            return(false);
                        }
                    }
                    else
                    {
                        CommonEngine.ShowMessage(LanguageEngine.GetMessageCaption("000009", ConfigEngine.Language), MessageType.Error);
                        txtUsername.Focus();
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                txtUsername.Focus();
                return(false);
            }

            return(true);
        }
예제 #8
0
 private void ChangeCaptionLanguage(string language)
 {
     LanguageEngine.ChangeCaptionCheckEdit(this.Name, language, chkRemember);
     LanguageEngine.ChangeCaptionHyperLinkEdit(this.Name, language, hplForgotPassword);
     LanguageEngine.ChangeCaptionLabelControl(this.Name, language, lblTitle);
     LanguageEngine.ChangeCaptionSimpleButton(this.Name, language, new SimpleButton[] { btnLogin, btnExit });
     LanguageEngine.ChangeCaptionImageComboBoxEdit(this.Name, language, icbLanguage);
     LanguageEngine.ChangeCaptionLayoutControlItem(this.Name, language, new DevExpress.XtraLayout.LayoutControlItem[] { lciLanguage, lciUsername, lciPassword });
     LanguageEngine.ChangeTextXtraForm(this, language);
     LanguageEngine.ChangeFormSize(this, this.Name, ConfigEngine.TouchMode);
 }
예제 #9
0
        public static void ExportGridViewData(DataTable data_source, GridView grid_view, string file_name = "")
        {
            if (data_source != null && data_source.Rows.Count > 0)
            {
                SaveFileDialog sDialog = new SaveFileDialog();
                sDialog.Filter = "Microsoft Excel (*.xls)|*.xls|Microsoft Excel 2007 (*.xlsx)|*.xlsx|PDF (*.pdf)|*.pdf|Rich Text Format (*.rtf)|*.rtf|Webpage (*.html)|*.html|Rich Text File (*.rtf)|*.rtf|Text File (*.txt)|*.txt";
                sDialog.Title  = LanguageEngine.GetMessageCaption("000007", ConfigEngine.Language);
                if (!string.IsNullOrEmpty(file_name))
                {
                    sDialog.FileName = FileEngine.CreateUniqueFileName(file_name);
                }
                if (sDialog.ShowDialog() == DialogResult.OK)
                {
                    switch (sDialog.FilterIndex)
                    {
                    case 1:
                        grid_view.ExportToXls(sDialog.FileName);
                        break;

                    case 2:
                        grid_view.ExportToXlsx(sDialog.FileName);
                        break;

                    case 3:
                        grid_view.ExportToPdf(sDialog.FileName);
                        break;

                    case 4:
                        grid_view.ExportToText(sDialog.FileName);
                        break;

                    case 5:
                        grid_view.ExportToHtml(sDialog.FileName);
                        break;

                    case 6:
                        grid_view.ExportToRtf(sDialog.FileName);
                        break;

                    case 7:
                        grid_view.ExportToText(sDialog.FileName);
                        break;
                    }
                    if (XtraMessageBox.Show(LanguageEngine.GetMessageCaption("000006", ConfigEngine.Language).Replace("$FileName$", sDialog.FileName), (ConfigEngine.Language == "vi") ? "Thông Báo" : "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        Process.Start(sDialog.FileName);
                    }
                }
            }
            else
            {
                return;
            }
        }
예제 #10
0
 private void txtUsername_EditValueChanged(object sender, EventArgs e)
 {
     if (txtUsername.Text.Contains(" "))
     {
         depError.SetError(txtUsername, LanguageEngine.GetMessageCaption("000004", ConfigEngine.Language));
     }
     else
     {
         depError.SetError(txtUsername, (string.IsNullOrEmpty(txtUsername.Text)) ? LanguageEngine.GetMessageCaption("000003", ConfigEngine.Language) : null);
     }
 }
예제 #11
0
        private async Task <bool> CheckValidTemplate()
        {
            bool     temp = false;
            FileInfo file;
            var      sheetName = "";

            foreach (var item in fileList)
            {
                try
                {
                    if (!CommonEngine.CheckExistsUnicodeChar(item.FileName))
                    {
                        item.IsValid = false;
                        item.Note    = LanguageEngine.GetMessageCaption("000021", ConfigEngine.Language);
                    }
                    file = new FileInfo(item.FilePath);
                    CommonEngine.SetWaitFormInfo("Đang kiểm tra tập tin " + file.Name, "Checking file " + file.Name, 1);
                    if (file.Exists)
                    {
                        temp = await ReportEngine.CheckValidImportTemplate(CommonEngine.userInfo.UserID, ConfigEngine.Language, strStoreProcedure, file.Name, strModuleID, strFunctionID, file.FullName);

                        if (!temp)
                        {
                            item.IsValid = false;
                            item.Note    = ConfigEngine.Language.Equals("vi") ? "Mẫu không hợp lệ!" : "Invalid template!";
                        }
                        else
                        {
                            item.IsValid   = true;
                            item.Note      = ConfigEngine.Language.Equals("vi") ? "Mẫu hợp lệ!" : "Valid template!";
                            item.SheetName = sheetName;
                            string tmp = item.FileName;
                            tmp            = tmp.Substring(0, tmp.LastIndexOf('.'));
                            tmp            = Regex.Replace(tmp, @"[^a-zA-Z0-9\s-().\[\]]", "");
                            item.TableName = tmp;
                        }
                    }
                    else
                    {
                        item.IsValid = false;
                        item.Note    = ConfigEngine.Language.Equals("vi") ? "Tập tin không tồn tại!" : "File not exists!";
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                }
            }
            grvSeletedFiles.RefreshData();

            return(true);
        }
예제 #12
0
 public void ChangeLanguage(string language)
 {
     LanguageEngine.ChangeCaptionLayoutControlGroup(this.Name, language, new DevExpress.XtraLayout.LayoutControlGroup[] { logSelectedFiles, logGridMainData });
     LanguageEngine.ChangeCaptionLayoutControlItem(this.Name, language, new DevExpress.XtraLayout.LayoutControlItem[] { lciBrowseFile, lciFileList });
     LanguageEngine.ChangeCaptionSimpleButton(this.Name, language, new SimpleButton[] { btnDownloadTemplate, btnCheckValid, btnImportAllFiles, btnImportSelectedFile });
     LanguageEngine.ChangeCaptionLabelControl(this.Name, language, new LabelControl[] { lblResult3, lblResult4, lblResult5, lblResult6 });
     LanguageEngine.ChangeCaptionGroupPanelTextGridView(this.Name, language, grvSeletedFiles);
     LanguageEngine.ChangeCaptionGridColumn(this.Name, language, new DevExpress.XtraGrid.Columns.GridColumn[] { gcolSelectedFileName, gcolSelectedFileSize, gcolSelectedDateModified, gcolSelectedNote, gcolSeletedFilePath });
     LanguageEngine.ChangeCaptionButtonWizardControl(this.Name, language, wzcMain);
     LanguageEngine.ChangeCaptionWelcomeWizardPage(this.Name, language, wwpStepOne);
     LanguageEngine.ChangeCaptionWizardPage(this.Name, language, wwpStepTwo);
     LanguageEngine.ChangeCaptionCompletionWizardPage(this.Name, language, wwpStepThree);
 }
예제 #13
0
        public static void OpenInputForm(XtraUserControl uc, Size size)
        {
            frmOpen frm = new frmOpen();

            frm.Text        = LanguageEngine.GetOpenFormText(uc.Name, ConfigEngine.Language);
            frm.Size        = size;
            frm.MaximumSize = size;
            frm.MinimumSize = size;
            frm.Controls.Clear();
            uc.Dock = DockStyle.Fill;
            frm.Controls.Add(uc);
            uc.Show();
            frm.ShowDialog();
        }
예제 #14
0
 private void LoadDataToEdit(SYS_tblGroupUserDTO item)
 {
     txtGroupID.EditValue   = (item == null) ? null : item.GroupID;
     txtGroupCode.EditValue = (item == null) ? null : item.GroupCode;
     //txtGroupCode.Properties.ReadOnly = (item == null) ? false : true;
     txtVNName.EditValue  = (item == null) ? null : item.VNName;
     txtENName.EditValue  = (item == null) ? null : item.ENName;
     mmoNote.EditValue    = (item == null) ? null : item.Note;
     chkIsDefault.Checked = (item == null) ? false : item.IsDefault;
     chkActive.Checked    = (item == null) ? true : item.Active;
     if (item == null)
     {
         depError.ClearErrors();
         this.ParentForm.Text = LanguageEngine.GetOpenFormText(this.Name, ConfigEngine.Language, false);
         txtGroupCode.Focus();
     }
 }
예제 #15
0
 private void txtGroupCode_EditValueChanged(object sender, EventArgs e)
 {
     if (txtGroupCode.Text.Contains(" "))
     {
         depError.SetError(txtGroupCode, LanguageEngine.GetMessageCaption("000004", ConfigEngine.Language));
     }
     else if (string.IsNullOrEmpty(txtGroupCode.Text))
     {
         depError.SetError(txtGroupCode, LanguageEngine.GetMessageCaption("000003", ConfigEngine.Language));
     }
     else if (CommonEngine.CheckExistsUnicodeChar(txtGroupCode.Text))
     {
         depError.SetError(txtGroupCode, LanguageEngine.GetMessageCaption("000021", ConfigEngine.Language));
     }
     else
     {
         depError.SetError(txtGroupCode, null);
     }
 }
예제 #16
0
        public static void OpenMdiChildForm(RibbonForm index, XtraUserControl uc, XtraTabbedMdiManager tab)
        {
            bool found = false;

            foreach (XtraForm frm in index.MdiChildren)
            {
                if (frm.Name.Equals(uc.Name))
                {
                    found = true;
                    break;
                }
            }

            if (found)
            {
                foreach (XtraMdiTabPage _tab in tab.Pages)
                {
                    if (_tab.Text.ToLower().Equals(LanguageEngine.GetOpenFormText(uc.Name, ConfigEngine.Language).ToLower()))
                    {
                        tab.SelectedPage = _tab;
                        break;
                    }
                }
            }
            else
            {
                XtraForm frm = new XtraForm();
                frm.Text      = LanguageEngine.GetOpenFormText(uc.Name, ConfigEngine.Language);
                frm.Name      = uc.Name;
                frm.MdiParent = index;
                uc.Dock       = DockStyle.Fill;
                frm.Controls.Clear();
                frm.Controls.Add(uc);
                frm.Show();
            }
        }
예제 #17
0
 public static void ShowExceptionMessage(Exception ex)
 {
     logger.Error(ex);
     CloseWaitForm();
     XtraMessageBox.Show(ex.Message, LanguageEngine.GetMessageCaption("ERROR_SYSTEM_TITLE_CAPTION", ConfigEngine.Language), MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
예제 #18
0
        public static void ShowHTTPErrorMessage(iPOS.DRO.ResponseItem res)
        {
            string title = LanguageEngine.GetMessageCaption("ERROR_TITLE_CAPTION", ConfigEngine.Language);

            XtraMessageBox.Show(string.Format("Request error: {0}\n{1}", res.ErrorCode, res.ErrorMessage), title, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
예제 #19
0
 private void txtENName_EditValueChanged(object sender, EventArgs e)
 {
     depError.SetError(txtENName, string.IsNullOrEmpty(txtENName.Text.Trim()) ? LanguageEngine.GetMessageCaption("000003", ConfigEngine.Language) : null);
 }