예제 #1
0
        private bool UpdateTimeEntry()
        {
            oldItem.AssociatedDate = associatedDate;
            oldItem.Description    = rtbDescription.Text;
            oldItem.OfficeRate     = (Rate)cmbRates.SelectedItem;
            oldItem.OfficeRateId   = oldItem.OfficeRate.ID;
            oldItem.FieldRate      = (Rate)cmbRates.SelectedItem;
            oldItem.FieldRateId    = oldItem.FieldRate.ID;

            if (isOfficeEntry)
            {
                oldItem.OfficeTime = (associatedDate + dtpTimeEntry.Value.TimeOfDay).TimeOfDay;
                oldItem.FieldTime  = TimeSpan.Zero;
            }
            else
            {
                oldItem.FieldTime  = (associatedDate + dtpTimeEntry.Value.TimeOfDay).TimeOfDay;
                oldItem.OfficeTime = TimeSpan.Zero;
            }

            if (oldItem.IsValidItem)
            {
                TimeEntryAdded?.Invoke(this, new ObjectCreatedEventArgs(oldItem, true));
                return(true);
            }
            else
            {
                CMessageBox.Show("Not enough information to update entry. " +
                                 DatabaseError.BillingItemIncomplete.ToDescriptionString(), "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }
        }
        private void cmdVerify_Click(object sender, RoutedEventArgs e)
        {
            Boolean r = SaveToView();

            if (!r)
            {
                return;
            }

            CUtil.EnableForm(false, this);
            vw.DocumentType = ((int)dt).ToString();
            CTable t = verifyAccountDocWrapper();

            CUtil.EnableForm(true, this);
            if (t != null)
            {
                MInventoryDoc ivd = new MInventoryDoc(t);
                ivd.InitErrorItem();
                if (ivd.ErrorItems.Count > 0)
                {
                    WinErrorDetails w = new WinErrorDetails(ivd.ErrorItems, "InventoryDoc");
                    w.Title = CLanguage.getValue("approve_error");
                    w.ShowDialog();
                }
                else
                {
                    String msg = CLanguage.getValue("VERIFY_SUCCESS");
                    CMessageBox.Show(msg, "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
예제 #3
0
        private void ddlDatabase_Enter(object sender, EventArgs e)
        {
            if (ddlDatabase.Items.Count > 0) return;
            //ddlDatabase.Items.Clear();
            string conStr1 = "Persist Security Info=False;User ID={1};Password={2};Server={0};Initial Catalog=master";
            string conStr2 = "Persist Security Info=False;Integrated Security=true;Server={0};Initial Catalog=master";
            string conStr = "";
            if (string.IsNullOrEmpty(tbxUserName.Text.Trim()))
            {
                conStr = string.Format(conStr2, tbxServer.Text);
            }
            else
            {
                conStr = string.Format(conStr1, tbxServer.Text, tbxUserName.Text, tbxPassword.Text);
            }

            SqlConnection con = new SqlConnection(conStr);
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                CMessageBox.Show(_Owner, ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            SqlCommand cmd = new SqlCommand("select name from sysdatabases", con);
            IDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                ddlDatabase.Items.Add(reader.GetString(0));
            }
            reader.Close();
            con.Close();
        }
예제 #4
0
        private void LoadProject()
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.Filter = "Xml文件|*.xml";

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                //projectPath = dlg.FileName;
                Project = Project.Load(dlg.FileName);
                if (!string.IsNullOrEmpty(Project.Namespace))
                {
                    TreeFrm loadtreeFrm = new TreeFrm(this);
                    loadtreeFrm.projectPath = dlg.FileName;

                    loadtreeFrm.Project = Project;
                    projectPath         = dlg.FileName;
                    loadtreeFrm.Text    = Project.Namespace + " - 基础数据结构";
                    loadtreeFrm.UpdateUI();
                    loadtreeFrm.Show();
                }
                else
                {
                    CMessageBox.Show(this, "项目载入失败,请检查该文件的格式项目是否是正确。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #5
0
        private bool AddTimeEntry()
        {
            BillingItem item = new BillingItem();

            item.AssociatedDate = associatedDate;
            item.Description    = rtbDescription.Text;
            item.OfficeRate     = (Rate)cmbRates.SelectedItem;
            item.OfficeRateId   = item.OfficeRate.ID;
            item.FieldRate      = (Rate)cmbRates.SelectedItem;
            item.FieldRateId    = item.FieldRate.ID;

            if (isOfficeEntry)
            {
                item.OfficeTime = new TimeSpan(dtpTimeEntry.Value.Hour, dtpTimeEntry.Value.Minute, dtpTimeEntry.Value.Second);
                item.FieldTime  = TimeSpan.Zero;
            }
            else
            {
                item.FieldTime  = new TimeSpan(dtpTimeEntry.Value.Hour, dtpTimeEntry.Value.Minute, dtpTimeEntry.Value.Second);
                item.OfficeTime = TimeSpan.Zero;
            }

            if (item.IsValidItem)
            {
                TimeEntryAdded?.Invoke(this, new ObjectCreatedEventArgs(item, false));
                return(true);
            }
            else
            {
                CMessageBox.Show("Not enough information to add new entry. " +
                                 DatabaseError.BillingItemIncomplete.ToDescriptionString(), "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }
        }
예제 #6
0
        public bool SaveInfo()
        {
            if (txtJobNumber.Text.Length == 0)
            {
                CMessageBox.Show("The job number cannot be empty!", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }

            if (txtAbstract.Text.Length == 0)
            {
                CMessageBox.Show("The abstract cannot be empty!", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }

            if (txtSurvey.Text.Length == 0)
            {
                CMessageBox.Show("The survey name cannot be empty!", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }

            if (txtNumOfAcres.Text.Length == 0)
            {
                CMessageBox.Show("The number of acres cannot be empty!", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }

            JobHandler.Instance.CurrentJob.JobNumber      = txtJobNumber.Text;
            JobHandler.Instance.CurrentJob.AbstractNumber = txtAbstract.Text;
            JobHandler.Instance.CurrentJob.SurveyName     = txtSurvey.Text;
            JobHandler.Instance.CurrentJob.Acres          = double.Parse(txtNumOfAcres.Text);
            return(true);
        }
예제 #7
0
        private void btnTryConnect_Click(object sender, EventArgs e)
        {
            //ddlDatabase.Items.Clear();
            string conStr1 = "Server={0};Port={1};Uid={2};Pwd={3};";
            //string conStr2 = "Persist Security Info=False;Integrated Security=true;Server={0};Initial Catalog=master";
            string conStr = "";

            if (string.IsNullOrEmpty(txtHost.Text.Trim()) || string.IsNullOrEmpty(txtPort.Text.Trim()) || string.IsNullOrEmpty(txtUser.Text.Trim()) || string.IsNullOrEmpty(txtPassword.Text.Trim()))
            {
                CMessageBox.Show(this, "服务器信息没填写完整。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            conStr = string.Format(conStr1, txtHost.Text.Trim(), txtPort.Text.Trim(), txtUser.Text.Trim(), txtPassword.Text.Trim());

            MySqlConnection con = new MySqlConnection(conStr);

            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                CMessageBox.Show(ex.Message);
                return;
            }
            MySqlCommand cmd    = new MySqlCommand("show databases", con);
            IDataReader  reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comDatabaseList.Items.Add(reader.GetString(0));
            }
            reader.Close();
            con.Close();
        }
예제 #8
0
        private void Save(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbxTitle.Text) || string.IsNullOrEmpty(tbxTitle.Text))
            {
                tbxTitle.Focus();
                CMessageBox.Show(Owner, "项目名称或命名空间必须填写!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Visible = false;
            TreeFrm treeFrm = new TreeFrm(_Owner, this);

            //treeFrm.TopMost = true;
            treeFrm.TopLevel = false;   //这个必须有不然会提示:"不能向tabControl中添加顶级控件"
            //treeFrm.Dock = DockStyle.Fill;
            treeFrm.UpdateProjectNode(Project);
            Helpler.ChangeTitle(false, treeFrm);
            _Owner.mainTab.TabPages.Add(treeFrm.Text);
            //treeFrm.FormBorderStyle = FormBorderStyle.None;
            foreach (Control con in treeFrm.Controls)
            {
                con.Dock = DockStyle.None;
                _Owner.mainTab.TabPages[_Owner.mainTab.TabPages.Count - 1].Controls.Add(con);
                _Owner.mainTab.SelectedIndex = _Owner.mainTab.TabPages.Count - 1;
            }
            // treeFrm.Show();
            // treeFrm.mod
            //tabControl1.TabPages[0].Controls.Add(form);
            this.Close();
        }
예제 #9
0
        /// <summary>
        /// 初始化数据(数据库和PLC数据)
        /// </summary>
        private void InitData()
        {
            DataBase.DBHelp.FileName = DataBase.DBHelp.fileName;//数据库路径初始化
            //检查数据库文件是否存在,不存在则创建
            if (!DataBase.DBHelp.CreteFilesName())
            {
                CMessageBox.Show("没有数据库模板", "提示");
                Environment.Exit(0);
            }
cc:
            //连接PLC
            if (Lib.S71KConnect.ConnectPLC())
            {
                Lib.S71KConnect.StartPLCRead();
            }
            else
            {
                Lib.S71KConnect.StopPLCRead();
                goto cc;
            }

            VersionNumber = 1.2;                                                  //显示版本号
            ProductNumber = LoginWindowViewModel.productNumber.ProductNumberFull; //显示焊缝编号
            //启动更新线程
            if (Lib.S71KConnect.userItem.ConnectionState)
            {
                uiThread = new Thread(new ThreadStart(UpDataThread));
                uiThread.IsBackground = true;
                uiThread.Start();
            }
        }
예제 #10
0
        public void NewNode()
        {
            operation = ChangeTypes.None;
            switch (_CurrentNode)
            {
            case Nodes.None:
                operation = ChangeTypes.CreateProject;
                CreateProject();
                break;

            case Nodes.Project:
                operation = ChangeTypes.AddTable;
                CreateTable();
                break;

            case Nodes.Table:
                operation = ChangeTypes.AddCol;
                CreateCol();
                break;

            case Nodes.Col:
                CMessageBox.Show(_Owner, "下面不能继续创建了。");
                break;
            }
        }
예제 #11
0
        public void DeleteNode()
        {
            if (CMessageBox.Show(_Owner, "是否删除当前节点", "请确认", MessageBoxButtons.OKCancel,
                                 MessageBoxIcon.Question) == DialogResult.Cancel)
            {
                return;
            }
            _Modified = true;
            Helpler.ChangeTitle(false, this);
            if (_CurrentNode == Nodes.Table)
            {
                Table table = _CurrentTreeViewItem.Tag as Table;

                operation = ChangeTypes.DropTable;
                WriteSqlLog(null, null); //没有col,但有当前 table,通过 ChangeTypes.DropTable 删除表

                TreeNode parentTV = _CurrentTreeViewItem.Parent as TreeNode;
                parentTV.Nodes.Remove(_CurrentTreeViewItem);
                _Project.Tables.Remove(table);
                CMessageBox.Show(_Owner, "删除成功!", "提示");
            }
            else if (_CurrentNode == Nodes.Col)
            {
                Col col = _CurrentTreeViewItem.Tag as Col;

                operation = ChangeTypes.DropCol;
                WriteSqlLog(col, null);  //删除列

                TreeNode parentTV = _CurrentTreeViewItem.Parent as TreeNode;
                parentTV.Nodes.Remove(_CurrentTreeViewItem);
                Table table = parentTV.Tag as Table;
                table.Cols.Remove(col);
                CMessageBox.Show(_Owner, "删除成功!", "提示");
            }
        }
        /// <summary>
        /// 接头编号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NumberTbx_TextChanged(object sender, TextChangedEventArgs e)
        {
            Match m = Regex.Match(NumberTbx.Text, pattern); // 匹配正则表达式

            if (!m.Success)                                 // 输入的不是数字
            {
                CMessageBox.Show("只能输入数字!", "提示", CMessageBoxButton.OK, CMessageBoxImage.Warning);
                if (NumberTbx.SelectionStart > 0)
                {
                    NumberTbx.Text = NumberTbx.Text.Remove(NumberTbx.SelectionStart - 1, 1);
                }
                NumberTbx.SelectionStart = NumberTbx.Text.Length;
            }
            else if (NumberTbx.Text != "")
            {
                try
                {
                    partNumber.numberSet = Convert.ToInt32(NumberTbx.Text);
                    Lib.CofigIni.InifileWriteValue("设置", "接头号", partNumber.numberSet.ToString(), Lib.CofigIni.iniPath);
                }
                catch
                {
                    MessageBox.Show("只能输入数字!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                    if (NumberTbx.SelectionStart > 0)
                    {
                        NumberTbx.Text = NumberTbx.Text.Remove(NumberTbx.SelectionStart - 1, 1);
                    }
                    NumberTbx.SelectionStart = NumberTbx.Text.Length;
                    return;
                }
            }
        }
예제 #13
0
        private void cmdVerify_Click(object sender, RoutedEventArgs e)
        {
            Boolean r = SaveToView();

            if (!r)
            {
                return;
            }

            CUtil.EnableForm(false, this);
            CTable t = OnixWebServiceAPI.VerifyVoidedDoc(vw.GetDbObject().CloneAll());

            CUtil.EnableForm(true, this);

            if (t != null)
            {
                MInventoryDoc ivd = new MInventoryDoc(t);
                ivd.InitErrorItem();
                if (ivd.ErrorItems.Count > 0)
                {
                    WinErrorDetails w = new WinErrorDetails(ivd.ErrorItems, "InventoryDoc");
                    w.Title = CLanguage.getValue("approve_error");
                    w.ShowDialog();
                }
                else
                {
                    String msg = CLanguage.getValue("VERIFY_SUCCESS");
                    CMessageBox.Show(msg, "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
예제 #14
0
        private void CheckForAssociation()
        {
            if (JobHandler.Instance.IsJobOpen)
            {
                if (entity != EntityTypes.Rate) //only associate with the open job if the object is not a Rate object.
                {
                    if (CMessageBox.Show("Associate this object with the open job?", "", MessageBoxButtons.YesNo, Resources.info_64x64) == DialogResult.Yes)
                    {
                        switch (entity)
                        {
                        case EntityTypes.Client:
                            JobHandler.Instance.CurrentJob.Client = obj as Client;
                            break;

                        case EntityTypes.Realtor:
                            JobHandler.Instance.CurrentJob.Realtor = obj as Realtor;
                            break;

                        case EntityTypes.TitleCompany:
                            JobHandler.Instance.CurrentJob.TitleCompany = obj as TitleCompany;
                            break;
                        }
                        JobHandler.Instance.UpdateSavePending(true);
                    }
                }
            }
        }
예제 #15
0
        private void SaveObject()
        {
            DatabaseError e = obj.Insert();

            if (e != DatabaseError.NoError)
            {
                CRichMsgBox.Show("An error has occured while saving the object to the database. See below for more details.",
                                 "Error", e.ToDescriptionString(), MessageBoxButtons.OK, Resources.error_64x64);
                return;
            }

            StatusUpdate?.Invoke(this, new StatusArgs($"{entity} {obj} created successfully."));
            CheckForAssociation();

            if (CMessageBox.Show("Create another?", "", MessageBoxButtons.YesNo, Resources.info_64x64) == DialogResult.Yes)
            {
                Clear();
            }
            else
            {
                if (RuntimeVars.Instance.MainForm.DockingWorkspace.DockingManager.FindDockingFloating("Floating")
                    .DockingManager.ContainsPage(RuntimeVars.Instance.SelectedPageUniqueName))
                {
                    RuntimeVars.Instance.MainForm.DockingWorkspace.DockingManager.FindDockingFloating("Floating")
                    .DockingManager.RemovePage(RuntimeVars.Instance.SelectedPageUniqueName, true);
                }
                else
                {
                    RuntimeVars.Instance.MainForm.DockingWorkspace.RemovePage(RuntimeVars.Instance.SelectedPageUniqueName, true);
                }
            }
        }
        private Boolean validateReceiptItem()
        {
            foreach (MAccountDocReceipt rcp in vw.ReceiptItems)
            {
                if (rcp.ExtFlag.Equals("D"))
                {
                    continue;
                }

                if (!vw.EntityId.Equals(rcp.EntityID))
                {
                    CMessageBox.Show(CLanguage.getValue("ERROR_INVALID_ENTITY") + " " + rcp.DocumentNo, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    return(false);
                }
            }

            if (CUtil.StringToDouble(vw.CashReceiptAmt) < 0)
            {
                //Equal zero is fine
                CMessageBox.Show(CLanguage.getValue("ERROR_RECEIPT_AMOUNT"), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            return(true);
        }
예제 #17
0
        private void DownloadFiles(object sender, EventArgs e)
        {
            if (typeOfData != EntityTypes.Survey)
            {
                return;
            }

            if (!(propGrid.SelectedObject as Survey).HasFiles)
            {
                CMessageBox.Show("No files associated with this survey.", "Nothing to Download", MessageBoxButtons.OK, Resources.warning_64x64);
                return;
            }

            using (ZipFile zip = new ZipFile())
            {
                foreach (CFile file in (propGrid.SelectedObject as Survey).Files)
                {
                    zip.AddEntry(file.FullFileName, new MemoryStream(file.Contents));
                }

                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    zip.Save(saveDialog.FileName);
                }
            }
        }
        private Boolean validatePayment()
        {
            int    cnt   = 0;
            double total = 0;

            foreach (MAccountDocPayment pmt in vw.PaymentItems)
            {
                if (pmt.ExtFlag.Equals("D"))
                {
                    continue;
                }

                total = total + CUtil.StringToDouble(pmt.PaidAmount);
                cnt++;
            }

            if (cnt <= 0)
            {
                CMessageBox.Show(CLanguage.getValue("ERROR_NO_PAYMENT"), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            double amt = CUtil.StringToDouble(vw.CashReceiptAmt);

            if (total < amt)
            {
                CMessageBox.Show(CLanguage.getValue("ERROR_PAYMENT_NOT_ENOUGH"), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            return(true);
        }
예제 #19
0
 private void ResetLicensingStatus_Click(object sender, RoutedEventArgs e)
 {
     if (CMessageBox.Show(Find("MsgResetLicensingStatus"), Find("MsgWarning"), CMessageBoxButton.YesNO, CMessageBoxImage.Question) == CMessageBoxResult.Yes)
     {
         BackgroundDoWork("files\\activate\\OSPPREARM.EXE", string.Empty);
     }
 }
예제 #20
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Mutex mutex = new Mutex(true, Process.GetCurrentProcess().ProcessName, out canCreateNew);

            //加载配置文件
            try
            {
                if (File.Exists(confpath))
                {
                    XmlDocument xd = new XmlDocument();
                    xd.Load(confpath);
                    string xml = Helpler.Serialize(xd);
                    history = Helpler.DeSerialize <History>(xml);
                }
                if (history == null)
                {
                    history = new History();
                }
            }
            catch { }
            if (canCreateNew)
            {
                Application.Run(new MainFrm());
            }
            else
            {
                CMessageBox.Show(null, "程序已经在运行", "提示");
            }
            //Application.Run(new Form1());
        }
예제 #21
0
        private void cmdTest_Click(object sender, RoutedEventArgs e)
        {
            OnixConnectionXML dbos = new OnixConnectionXML(txtDesc.Password, url, "pemgail9uzpgzl88");

            String sendString = "HELLOWORLD";

            CTable t = new CTable("");

            t.SetFieldValue("ECHO_MESSAGE", sendString);
            CUtil.EnableForm(false, this);
            CTable echo = OnixWebServiceAPI.TestServer(dbos, t);

            CUtil.EnableForm(true, this);

            if (echo == null)
            {
                CMessageBox.Show(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                String returnStr = echo.GetFieldValue("RETURN_MESSAGE");
                if (sendString.Equals(returnStr))
                {
                    CMessageBox.Show(CLanguage.getValue("connect_success"), "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    CMessageBox.Show(CLanguage.getValue("connect_fail"), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
예제 #22
0
        private void FrmBoard_Load(object sender, EventArgs e)
        {
#if (x86)
            {
                var ret = IPCAPI32.F75111_Init();
                if (!ret)
                {
                    CMessageBox.Show("Init F75111 Failed...");
                    Disabeld();
                    return;
                }
            }
#endif
#if (x64)
            {
                var ret = IPCAPI64.F75111_Init();
                if (ret == 0)
                {
                    CMessageBox.Show("Init F75111 Failed...");
                    Disabeld();
                    return;
                }
            }
#endif
        }
예제 #23
0
        /// <summary>
        /// Save the settings to <see cref="Settings.Default"/>.
        /// </summary>
        public void SaveSettings()
        {
            if (Validator.ValidateEmail(txtSMTPUsername.Text) && Validator.ValidateEmail(txtFromAddress.Text))
            {
                if (int.TryParse(txtSMTPPort.Text, out int port))
                {
                    Settings.Default.MailFromAddress    = txtFromAddress.Text;
                    Settings.Default.MailServerHost     = txtSMTPServer.Text;
                    Settings.Default.MailServerPort     = port;
                    Settings.Default.MailServerUser     = txtSMTPUsername.Text;
                    Settings.Default.MailServerPassword = txtSMTPPassword.Text;

                    Settings.Default.Save();
                }
                else
                {
                    CMessageBox.Show("Invalid port number entered.", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                    return;
                }
            }
            else if (txtSMTPUsername.Text.Length > 0 || txtFromAddress.Text.Length > 0)
            {
                CMessageBox.Show("The email address entered was invalid.", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return;
            }
        }
예제 #24
0
        private Boolean validateReceiptItem()
        {
            int idx = 0;

            foreach (MAccountDocDeposit rcp in vw.DepositItems)
            {
                if (rcp.ExtFlag.Equals("D"))
                {
                    continue;
                }

                idx++;
                if (rcp.Note.Trim().Equals(""))
                {
                    CHelper.ShowErorMessage(idx.ToString(), "ERROR_SELECTION_TYPE", null);
                    return(false);
                }

                if (CUtil.StringToDouble(rcp.DepositAmt) <= 0)
                {
                    CHelper.ShowErorMessage(idx.ToString(), "ERROR_SELECTION_TYPE", null);
                    return(false);
                }
            }

            if (CUtil.StringToDouble(vw.CashReceiptAmt) < 0)
            {
                //Equal zero is fine
                CMessageBox.Show(CLanguage.getValue("ERROR_RECEIPT_AMOUNT"), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            return(true);
        }
예제 #25
0
 private void InstallLicenses_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     TaskProgressBar.ProgressState = TaskbarItemProgressState.None;
     Tab4Process.IsIndeterminate   = false;
     if (e.Error != null)
     {
         CMessageBox.Show(e.Error.Message, Find("MsgError"), CMessageBoxImage.Error);
     }
     else if (e.Result != null)
     {
         ToastMessage(e.Result.ToString(), string.Empty);
     }
     else
     {
         ToastMessage(Find("ToastLicensesInstallSuccess"), string.Empty);
     }
     try //删除多余文件,避免出错
     {
         DirectoryInfo di = new DirectoryInfo(TempInfo.FullName + "licenses\\");
         di.Delete(true);
     }
     catch
     { }
     InstallLicenses.Dispose();
 }
예제 #26
0
 private void PowerControlSet(int n)
 {
     if (n == 1)
     {
         if (CreateXMLFile(false, false))
         {
             StartInstallation(false, null);
             if (EnableNotify.IsChecked == true)
             {
                 notifyIcon.BalloonTipTitle = Find("MsgDownloadSuccessful");
                 notifyIcon.BalloonTipText  = Find("ToastAutomicStartedSetup");
                 notifyIcon.ShowBalloonTip(8000);
             }
             else
             {
                 ToastMessage(Find("ToastAutomicStartedSetup"), Find("MsgDownloadSuccessful"));
             }
         }
     }
     else if (n == 2)
     {
         Thread.Sleep(1000);
         SystemCommands.CloseWindow(this);
     }
     else if (n == 3)
     {
         Thread.Sleep(1000);
         PowerControl("0");
         SystemCommands.CloseWindow(this);
     }
     else if (n == 4)
     {
         Countdown = 0;
         ADIItemsAuto.Start();
         if (CMessageBox.Show(Find("MsgADIQuestion"), Find("MsgWarning"), CMessageBoxButton.OKCancel, CMessageBoxImage.Warning) == CMessageBoxResult.OK)
         {
             Countdown = 59;
         }
         else
         {
             ADIItemsAuto.Stop();
             Countdown = 0;
         }
     }
     else if (n == 5)
     {
         Countdown = 0;
         ADIItemsAuto.Start();
         if (CMessageBox.Show(Find("MsgADIQuestion"), Find("MsgWarning"), CMessageBoxButton.OKCancel, CMessageBoxImage.Warning) == CMessageBoxResult.OK)
         {
             Countdown = 59;
         }
         else
         {
             ADIItemsAuto.Stop();
             Countdown = 0;
         }
     }
 }
예제 #27
0
        private void ClearObject(object sender, EventArgs e)
        {
            DialogResult result = CMessageBox.Show("Clear all fields?", "Confirm", MessageBoxButtons.YesNo, Resources.warning_64x64);

            if (result == DialogResult.Yes)
            {
                Clear();
            }
        }
예제 #28
0
 private void ILicenses_Click(object sender, RoutedEventArgs e)
 {
     if (InstallLicenses.IsBusy)
     {
         ToastMessage(Find("ToastWorkerIsBusy"), Find("MsgNormalTitle"));
         return;
     }
     if (CMessageBox.Show(Find("MsgInstallLicenses"), Find("MsgNormalTitle"), CMessageBoxButton.YesNO, CMessageBoxImage.Question) == CMessageBoxResult.Yes)
     {
         string Licenses_Dir;
         string Key;
         if (ConversionSelected.SelectedIndex == 0)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\ProPlus16";
             Key          = "XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99";
         }
         else if (ConversionSelected.SelectedIndex == 1)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\Mondo16";
             Key          = "HFTND-W9MK4-8B7MJ-B6C4G-XQBR2";
         }
         else if (ConversionSelected.SelectedIndex == 2)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\Project16";
             Key          = "WGT24-HCNMF-FQ7XH-6M8K7-DRTW9";
         }
         else if (ConversionSelected.SelectedIndex == 3)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\Visio16";
             Key          = "69WXN-MBYV6-22PQG-3WGHK-RM6XC";
         }
         else if (ConversionSelected.SelectedIndex == 4)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\ProPlus17";
             Key          = "NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP";
         }
         else if (ConversionSelected.SelectedIndex == 5)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\Project17";
             Key          = "B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B";
         }
         else if (ConversionSelected.SelectedIndex == 6)
         {
             Licenses_Dir = TempInfo.FullName + "licenses\\VOL\\Visio17";
             Key          = "9BGNQ-K37YR-RQHF2-38RQ3-7VCBB";
         }
         else
         {
             string[] arg = new string[] { "2", "CommonLicenseFiles," + ConversionSelected.Text };
             InstallLicenses.RunWorkerAsync(arg);
             return;
         }
         // 0 内置证书,1 证书路径,2 Office 文件夹
         string[] ar = { "0", Licenses_Dir, Key, TempInfo.FullName + "licenses\\Common" };
         InstallLicenses.RunWorkerAsync(ar);
     }
 }
예제 #29
0
 private void button1_Click(object sender, EventArgs e)
 {
     ptr = CRTAPI.CommOpenWithBaut(portName, baudRate);
     if (ptr == IntPtr.Zero)
     {
         CMessageBox.Show("串口打开失败");
         return;
     }
     isOpen = true;
     Log("串口打开成功");
 }
예제 #30
0
        public bool SaveInfo()
        {
            if (txtDescription.Text.Length == 0)
            {
                CMessageBox.Show("The job's description cannot be empty!", "Error", MessageBoxButtons.OK, Resources.error_64x64);
                return(false);
            }

            JobHandler.Instance.CurrentJob.Description = txtDescription.Text;
            return(true);
        }