Esempio n. 1
0
 private void bnAbandon_Click(object sender, EventArgs e)
 {
     Function.SoundManager.PlayButtonSound();
     player.CurrentQuest = null;
     MessageForm mes = new MessageForm("You abandomed your quest!");
     mes.ShowDialog();
 }
Esempio n. 2
0
        private void EditRow(MessagesDataSet.MessagesRow current)
        {
            var messageForm = new MessageForm()
            {
                MessageName = current.Name,
                MessageText = current.Text,
            };

            messageForm.Closing += (sender, args) => {
                if (messageForm.DialogResult != DialogResult.OK)
                {
                    return;
                }

                try
                {
                    current.Name = messageForm.MessageName;
                    current.Text = messageForm.MessageText;
                    CommitChanges();
                }
                catch (Exception e)
                {
                    MessageBox.Show(String.Format("Error {0}", e.GetType()), "Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Hand,
                        MessageBoxDefaultButton.Button1);
                    args.Cancel = true;
                }
            };

            messageForm.ShowDialog();
        }
Esempio n. 3
0
        public bool Continue()
        {
            if (!OddsRadioButton.Checked && !EvensRadioButton.Checked && !TaperadioButton.Checked && !TapoRadioButton.Checked)
            {
                MessageForm msg = new MessageForm();
                msg.StartPosition = FormStartPosition.CenterParent;
                msg.msg = "Please select a server type first.";
                msg.foreColor = "red";
                msg.ShowDialog();
                return false;
            }

            if (IsRunning)
            {
                MessageForm msg = new MessageForm();
                msg.StartPosition = FormStartPosition.CenterParent;
                msg.msg = @"Please wait current jobs finish.
            Or you can stop it manually";
                msg.foreColor = "red";
                msg.ShowDialog();
                return false;
            }

            return true;
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenMassSenderCore.OpenMassSenderDBDataSet.JobRow job = JobTableAdapter.getInstance().getNewRow();

            job.query = "";
            job.group = "smaplist1";
            job.sender_account = 1;
            job.status = OpenMassSenderCore.OpenMassSenderDBDataSet.JobRow.JobStatus.PENDING;
            job.user = 1;

            job.messageObject.setMessage("hi $receiver_fname, This message send at $DATE(dd/MM/yyyy) is a notice");
            job.messageObject.subject = "A friendly notice";
            job.messageObject.job = job.ID;
            job.messageObject.replaceVariables = "customer=Customer";
            job.messageObject.user = job.user;
            job.messageObject.type = "email";
            job.messageObject.linkedFile = "";

            MessageForm msgForm = new MessageForm(job.messageObject, this);
            msgForm.Show();

            JobTableAdapter.getInstance().submitRow(job);
            MessageTableAdapter.getInstance().submitRow(job.messageObject);

            OpenMassSenderCore.OpenMassSenderDBDataSet.ReceiverRow receiver = (OpenMassSenderCore.OpenMassSenderDBDataSet.ReceiverRow)ReceiverTableAdapter.getInstance().GetDataById(1).Rows[0];

            Console.WriteLine("message:" + job.messageObject.replaceWildCards(receiver));

            foreach (OpenMassSenderCore.OpenMassSenderDBDataSet.JobRow row in JobTableAdapter.getInstance().GetData())
            {
                Console.WriteLine("aa:" + row.ID+"  messag:"+row.message);
            }
        }
Esempio n. 5
0
        static int show(string caption, Icon icon, string message, string[] buttons)
        {
            MessageForm mf = new MessageForm(caption, message, buttons, icon);

                mf.ShowInTaskbar = ShowInTaskbar;
                int i = mf.Display();
                return i;
        }
 public void makeNewPanel(String label1, String label2)
 {
     UtilClass.addIndex(1);
     MessageForm msgForm = new MessageForm(label1, label2);
     panelList.Add(msgForm);
     panelInitilize(panelList.Count - 1);
     msgForm.Show();
 }
Esempio n. 7
0
 public static int show_message(string msg)
 {
     var mf = new MessageForm();
     mf.Message = newlines(msg);
     mf.ShowDialog();
     //System.Windows.Forms.MessageBox.Show(newlines(args[0].String), Env.Title);
     return 0;
 }
Esempio n. 8
0
 public static void Show(string caption, string text)
 {
     if (instance == null)
     {
         instance = new MessageForm();
     }
     instance.Text = caption;
     instance.MessageText = text;
     instance.ShowDialog();
 }
Esempio n. 9
0
        public static DialogResult ShowMessage(string header, string message)
        {
            using (MessageForm f = new MessageForm())
            {
                f.lblHeader.Text = header;
                f.txtMessage.Text = message;

                return f.ShowDialog();
            }
        }
        static void MsgThreadProc()
        {
            System.Diagnostics.Debug.WriteLine(String.Format("{0} is threadID {1}", System.Threading.Thread.CurrentThread.Name, System.Threading.Thread.CurrentThread.ManagedThreadId));
            msgform = new MessageForm();

            msgform.StartPosition = FormStartPosition.CenterScreen;
            msgform.ShowInTaskbar = false;
            Application.Run(msgform);
            System.Diagnostics.Debug.WriteLine("ControlPanel Thread is exiting");
        }
Esempio n. 11
0
        public static DialogResult Show2(Type type, string title, string message, Color bgColor, Color fColor)
        {
            DialogResult ret = DialogResult.Cancel;

            using (MessageForm form = new MessageForm(message, title, (int)type, bgColor, fColor))
            {
                ret = form.ShowDialog();
            }

            return ret;
        }
Esempio n. 12
0
        public static DialogResult Show(string msgId, params string[] strList)
        {
            DialogResult ret = DialogResult.Cancel;

            // メッセージ文字列の作成
            string dispMsg = string.Format(MessageResouce.GetMessage(msgId), strList);

            using (MessageForm form = new MessageForm(dispMsg, System.Windows.Forms.Application.ProductName, (int)Type.Info, null, null))
            {
                ret = form.ShowDialog();
            }

            return ret;
        }
Esempio n. 13
0
        public static DialogResult Show(Type type, string title, string msgId, params string[] strList)
        {
            DialogResult ret = DialogResult.Cancel;

            // メッセージ文字列の作成
            string dispMsg = string.Format(MessageResouce.GetMessage(msgId), strList);

            using (MessageForm form = new MessageForm(dispMsg, title, (int)type, null, null))
            {
                ret = form.ShowDialog();
            }

            return ret;
        }
Esempio n. 14
0
        public static DialogResult Show(string Text, string Title, eDialogButtons Buttons, Image Image)
        {
            MessageForm message = new MessageForm();
            message.Text = Title;

            if (Image.Height < 0 || Image.Height > 100)
                throw new Exception("Invalid image height. Valid height ranges from 0 to 64.");
            else if (Image.Width < 0 || Image.Width > 100)
                throw new Exception("Invalid image width. Valid width ranges from 0 to 64.");
            else
            {
                message.picImage.Image = Image;
                message.lblText.Text = Text;

                switch (Buttons)
                {
                    case eDialogButtons.OK:
                        message.btnYes.Visible = false;
                        message.btnNo.Visible = false;
                        message.btnCancel.Visible = false;
                        message.btnOK.Location = message.btnCancel.Location;
                        break;
                    case eDialogButtons.OKCancel:
                        message.btnYes.Visible = false;
                        message.btnNo.Visible = false;
                        break;
                    case eDialogButtons.YesNo:
                        message.btnOK.Visible = false;
                        message.btnCancel.Visible = false;
                        message.btnYes.Location = message.btnOK.Location;
                        message.btnNo.Location = message.btnCancel.Location;
                        break;
                    case eDialogButtons.YesNoCancel:
                        message.btnOK.Visible = false;
                        break;
                }

                if (message.lblText.Height > 64)
                    message.Height = (message.lblText.Top + message.lblText.Height) + 78;

                return (message.ShowDialog());
            }
        }
Esempio n. 15
0
        private static void TextMessagePacketHandler(byte[] receivedPacket, Socket clientSocket)
        {
            //Radimo konverziju primljenog paketa (lambda expressions)
            TextMessagePackage textMessagePackage = new TextMessagePackage(receivedPacket);
            
            //Identificiramo klijenta koji je poslao poruku po socketu
            Client clientThatSentMessage = clientList.Find(client => client.clientSocket == clientSocket);

            if (!openedMessageForms.ContainsKey(clientSocket))
            {
                MessageForm NewMessageForm = new MessageForm(clientSocket);
                openedMessageForms.Add(clientSocket, NewMessageForm);
                NewMessageForm.ReceiveMessage(textMessagePackage.textMessage, clientThatSentMessage.clientComputerName);
                NewMessageForm.ShowDialog();                
                //Application.Run();                
            }
            else
            {
                MessageForm NewMessageForm = openedMessageForms[clientSocket];
                //NewMessageForm.ShowDialog();
                //NewMessageForm.Activate();
                NewMessageForm.ReceiveMessage(textMessagePackage.textMessage, clientThatSentMessage.clientComputerName);
            }
        }
Esempio n. 16
0
        public Form1()
        {
            InitializeComponent();

            model = new Model();
            messageForm = new MessageForm(model);

            //filling form from settings
            tbChatMonitor.Text = model.ChatName;
            for (int i = 0; i < model.Systems.Count; i++)
            {
                lstbSystemList.Items.Add(model.Systems[i].ToUpper());
            }

            //buttons on start
            if (model.TimerEnable == true)
                btnStart.Enabled = false;
            else
                btnStop.Enabled = false;


            //open transparent form with last messages
            messageForm.Show();
        }
Esempio n. 17
0
        private void SetLabelsAndPictures(int index)
        {
            foreach (var character in player.ControlledCharacters)
            {
                if (character.UnitName.Equals(comboBoxChooseChar.Items[index]))
                {
                    selectedChar = character;
                    break;
                }
            }

            this.pictureBoxChar.Image = Function.GeneralFunctions.ReturnImageForClass(selectedChar);

            if(selectedChar != null)
            {
                switch (theItem.ItemType)
                {
                    case EnumItemType.Weapon:
                        toBeReplaced = selectedChar.CharGear.Weapon;
                        break;
                    case EnumItemType.Armor:
                        if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Chestarmor)
                            toBeReplaced = selectedChar.CharGear.ChestArmor;
                        else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Headarmor)
                            toBeReplaced = selectedChar.CharGear.HeadArmor;
                        else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Legarmor)
                            toBeReplaced = selectedChar.CharGear.LegArmor;
                        break;
                    case EnumItemType.Battlecharm:
                        try
                        {
                            toBeReplaced = selectedChar.CharGear.BattleCharms[battleCharmIndex];
                        }
                        catch (Exception exp)
                        {
                            toBeReplaced = null;
                        }
                        finally { }
                        break;
                    default:
                        break;
                }

                this.labelEquippedItem.Text = Function.GeneralFunctions.ReturnItemLabelString(toBeReplaced);

                if (toBeReplaced != null)
                {
                    labelEquippedItem.ForeColor = Function.GeneralFunctions.ReturnProperColorForItem(toBeReplaced);

                    if (toBeReplaced.ItemType == EnumItemType.Battlecharm)
                        this.labelEquippedItem.Text += Environment.NewLine + "Click here to see the next battlecharm!";
                }

                labelCharacterStats.Text = selectedChar.CharClass +
                                "\nLevel: " + selectedChar.UnitLevel +
                                "\nXP: " + selectedChar.CharCurrentXP + "/" + selectedChar.CharXPToLevel +
                                "\nHealth: " + selectedChar.CurrentHP.IntValue + "/" + selectedChar.BuffedHP.IntValue +
                                "\nStrength: " + selectedChar.BuffedStrength.IntValue +
                                "\nAgility: " + selectedChar.BuffedAgility.IntValue +
                                "\nIntellect: " + selectedChar.BuffedIntellingence.IntValue +
                                "\nMelee: " + selectedChar.BuffedAttackDamage.IntValue +
                                "\nArmor: " + selectedChar.BuffedArmor.IntValue;

            }
            else
            {
                RPG.UI.MessageForm mes = new MessageForm("Something truly horrible happened!");
                mes.ShowDialog();
            }
        }
Esempio n. 18
0
 static ShortcutService2()
 {
     var form = new MessageForm();
     Handle = form.Handle;
     id = form.GetHashCode();
 }
Esempio n. 19
0
        private void SaveTournament()
        {
            Kv kv = new Kv();

            if (Tournament != null)
            {
                kv.Set("TournamentID", this.Tournament.TournamentID);
            }

            if (cmbType.SelectedValue != null)
            {
                kv.Set("TournamentTypeID", cmbType.SelectedValue.ToString());
            }

            if (cmbChessType.SelectedValue != null)
            {
                kv.Set("ChessTypeID", cmbChessType.SelectedValue.ToString());
            }

            if (cmbRound.SelectedItem != null)
            {
                kv.Set("Round", cmbRound.SelectedItem.ToString());
            }
            else
            {
                kv.Set("Round", 1);
            }

            if (cmbDblRound.SelectedItem != null)
            {
                kv.Set("DoubleRoundNo", Convert.ToInt32(cmbDblRound.Text));
            }
            else
            {
                kv.Set("DoubleRoundNo", 0);
            }

            if (cmbType.SelectedValue != null && cmbType.SelectedValue.ToString() == "3") // if knock-out tournament.
            {
                chkAllowTieBreak.Checked = numTieBreaks.Value > 0;
            }

            kv.Set("Rated", chkRated.Checked);
            kv.Set("DoubleRound", chkDoubleRound.Checked);
            kv.Set("IsTieBreak", chkAllowTieBreak.Checked);

            if (cmbMin.SelectedItem != null)
            {
                kv.Set("TimeControlMin", cmbMin.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TimeControlMin", 1);
            }

            if (cmbSec.SelectedItem != null)
            {
                kv.Set("TimeControlSec", cmbSec.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TimeControlSec", 1);
            }

            kv.Set("RegistrationStartDate", dtpRegStartDate.Value.ToString());
            kv.Set("RegistrationStartTime", dtpRegStartTime.Value.ToShortTimeString());

            kv.Set("RegistrationEndDate", dtpRegEndDate.Value.ToString());
            kv.Set("RegistrationEndTime", dtpRegEndTime.Value.ToShortTimeString());

            kv.Set("TournamentStartDate", dtpTournamentStartDate.Value.ToString());
            kv.Set("TournamentStartTime", dtpTournamentStartTime.Value.ToShortTimeString());

            kv.Set("TournamentStatusID", (int)TournamentStatusE.Scheduled);
            kv.Set("StatusID", (int)StatusE.Active);
            kv.Set("TournamentStartTime", dtpTournamentStartTime.Value.ToString());

            kv.Set("Name", txtTitle.Text);
            kv.Set("Description", txtInvitation.Text);

            if (cmbTbMin.SelectedItem != null)
            {
                kv.Set("TieBreakMin", cmbTbMin.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TieBreakMin", 1);
            }
            if (cmbTbSec.SelectedItem != null)
            {
                kv.Set("TieBreakSec", cmbTbSec.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TieBreakSec", 1);
            }
            kv.Set("NoOfGamesPerRound", numGames.Value);
            kv.Set("NoOfTieBreaks", numTieBreaks.Value);
            kv.Set("SuddenDeathWhiteMin", cmbWhiteMin.SelectedItem.ToString());
            kv.Set("SuddenDeathBlackMin", cmbBlackMin.SelectedItem.ToString());
            kv.Set("SuddenDeathSec", cmbSdSec.SelectedItem.ToString());

            if (chkAllowMultipleWinners.Checked)
            {
                kv.Set("MaxWinners", numMaxWinners.Value);
            }
            else
            {
                kv.Set("MaxWinners", 0);
            }

            ProgressForm frmProgress = ProgressForm.Show(this, "Saving Tournament...");

            DataSet ds = SocketClient.SaveTournament(kv);

            frmProgress.Close();

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    kv = new Kv(ds.Tables[0]);
                    this.Tournament = new App.Model.Db.Tournament(Ap.Cxt, ds.Tables[0].Rows[0]);
                }
            }
            else
            {
                return;
            }

            if (this.Tournament == null)
            {
                return;
            }

            if (OnTournamentSave != null)
            {
                OnTournamentSave(this, EventArgs.Empty);
            }

            if (this.Tournament != null)
            {
                if (this.Tournament.TournamentID > 0)
                {
                    MessageForm.Show(this.ParentForm, MsgE.ConfirmTournamentSaved, this.Tournament.Name);
                    cmbChessType.Enabled = false;
                }
            }


            if (OnVisibleTab != null)
            {
                OnVisibleTab(this, EventArgs.Empty);
            }

            ViewStartTournamentButton();
        }
Esempio n. 20
0
 //meta! userInfo="Process messages defined in code", id="0"
 public void ProcessDefault(MessageForm message)
 {
     switch (message.Code)
     {
     }
 }
        private void btnOk_Click(object sender, EventArgs e)
        {
            m_success = false;

            string password0 = m_PasswordBox0.Text;
            string password  = m_PasswordBox.Text;
            string password2 = m_PasswordBox2.Text;

            if (password0 == String.Empty)
            {
                m_ErrorProvider.SetError(m_PasswordBox0, "ÇëÊäÈë¾ÉÃÜÂë");
                return;
            }
            else
            {
                m_ErrorProvider.SetError(m_PasswordBox0, String.Empty);
            }
            if (password == String.Empty)
            {
                m_ErrorProvider.SetError(m_PasswordBox, "ÇëÊäÈëÐÂÃÜÂë");
                return;
            }
            else
            {
                m_ErrorProvider.SetError(m_PasswordBox, String.Empty);
            }
            if (password.Length < 6)
            {
                m_ErrorProvider.SetError(m_PasswordBox, "ÃÜÂ볤¶ÈСÓÚ6λ");
                return;
            }
            else
            {
                m_ErrorProvider.SetError(m_PasswordBox, String.Empty);
            }
            if (password != password2)
            {
                m_ErrorProvider.SetError(m_PasswordBox2, "Á½´ÎÊäÈëµÄÐÂÃÜÂ벻ƥÅä");
                return;
            }
            else
            {
                m_ErrorProvider.SetError(m_PasswordBox2, String.Empty);
            }

            try
            {
                using (var pm = new ProviderManager())
                {
                    IUserManager      userManager       = pm.DefaultProvider.CreateUserManager();
                    WebServiceManager webServiceManager = userManager as WebServiceManager;
                    if (webServiceManager != null)
                    {
                        webServiceManager.ReAuthenticate();
                    }

                    bool res = pm.DefaultProvider.CreatePasswordManager().ChangePasswordWithOldPassword(
                        SystemConfiguration.ApplicationName, SystemConfiguration.UserName,
                        password0, password);
                    if (res)
                    {
                        m_success = res;
                        MessageForm.ShowInfo("ÐÞ¸ÄÃÜÂë³É¹¦");
                    }
                    else
                    {
                        MessageForm.ShowInfo("ÐÞ¸ÄÃÜÂëʧ°Ü");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithResume(ex);
                MessageForm.ShowError("ÐÞ¸ÄÃÜÂëʧ°Ü");
            }

            if (m_success)
            {
                this.Close();
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 导入或修改CPOS
        /// </summary>
        /// <param name="importType">操作类型:“IMPORT”表示新导入;“UPDATE”表示修改已导入的轮胎信息/param>
        protected void ImportFuelData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            try
            {
                ChryslerUtils utils      = new ChryslerUtils();
                FolderDialog  openFolder = new FolderDialog();
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.MainFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.CposFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        //更新列表,记录更新的数据。存油耗值编号,初始为空
                        List <string> fuelUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportFuelData(fileName, folderPath, importType, fuelUpdateList);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = operateType + "结果";
                        mf.ShowDialog();

                        // 如果是新导入数据,导入完成后显示所有数据
                        if (importType == "IMPORT")
                        {
                            this.ShowCposFuelData();
                        }
                        else if (importType == "UPDATE")
                        {
                            // 如果是修改数据,界面只显示修改过的数据(为了接下来修改和这些轮胎信心关联的燃料数据)。
                            this.ShowUpdatedCposFuelData(fuelUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.CposFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 23
0
 //************************************************************************************************************************
 //************************************************************************************************************************
 //BASE METHODS
 //************************************************************************************************************************
 //************************************************************************************************************************
 static void preset(MessageForm mf)
 {
     lock (lock_variable2)
     {
         mf.Icon = WindowIcon;
         mf.ShowInTaskbar = ShowInTaskbar;
         if (NextTime_Owner == null)
         {
             mf.TopLevel = true;
             mf.TopMost = true;
         }
         else
             mf.Owner = NextTime_Owner;
     }
 }
Esempio n. 24
0
 private void ShowInvalidFileFormatMessage()
 {
     MessageForm.Show(this, MsgE.ErrorInvalidFileFormat);
 }
        private void CreateTournamentRounds()
        {
            if (this.Tournament == null)
            {
                return;
            }

            if (this.Tournament.TournamentID == 0)
            {
                return;
            }

            string msgID  = string.Empty;
            bool   isTrue = false;
            int    round  = 0;

            if (table != null)
            {
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow item in table.Rows)
                    {
                        TournamentMatchStatusE ts = (TournamentMatchStatusE)Convert.ToInt32(item["TournamentMatchStatusID"]);


                        if (ts != TournamentMatchStatusE.Finsihed && ts != TournamentMatchStatusE.Absent &&
                            Tournament.TournamentTypeIDE != TournamentTypeE.Knockout && Tournament.TournamentTypeIDE != TournamentTypeE.Swiss)
                        {
                            isTrue = true;
                        }

                        round = GetRoundNo(item["Round"].ToString());
                    }

                    if (isTrue)
                    {
                        MessageForm.Show(ParentForm, MsgE.ErrorTournamentNextRoundStarted);
                    }
                    else
                    {
                        DataSet ds = SocketClient.CreateTournamentRounds(Tournament.TournamentID, round + 1);

                        if (ds != null)
                        {
                            if (ds.Tables.Count > 0)
                            {
                                Kv kv = new Kv(ds.Tables[0]);
                                if (kv.GetInt32("Result") > 0)
                                {
                                    MessageForm.Error(this.ParentForm, (MsgE)kv.GetInt32("Result"));
                                    return;
                                }
                            }
                        }

                        if (this.Tournament.TournamentTypeE != TournamentTypeE.Swiss)
                        {
                            //Tournament.TournamentCurrentRound = round + 1;
                        }
                    }
                }
            }
            RefreshGrid();
        }
        private void RestartTournamentMatch(bool isRound, bool isFromLastMove)
        {
            if (this.Tournament == null)
            {
                return;
            }
            if (this.Tournament.TournamentID == 0)
            {
                return;
            }

            int          senderUserID         = 0;
            int          receiverUserID       = 0;
            int          tournamentDirectorID = 0;
            string       matchIDs             = string.Empty;
            string       msg         = string.Empty;
            ProgressForm frmProgress = null;

            if (IsTournamentDirector)
            {
                #region TournamentDirector
                if (isRound)
                {
                    msg = "Restarting Round Matches...";
                    tournamentDirectorID = Ap.CurrentUserID;
                    senderUserID         = tournamentDirectorID;
                }
                else
                {
                    tournamentDirectorID = Ap.CurrentUserID;
                    matchIDs             = GetSelectedMatchIDs();

                    if (!String.IsNullOrEmpty(matchIDs))
                    {
                        msg = "Restarting Selected Matches...";
                    }
                    else
                    {
                        MessageForm.Error(this.ParentForm, MsgE.ErrorTournamentMatchRestart, "");
                        return;
                    }
                }

                if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmRestartTournamentMatch) != DialogResult.Yes)
                {
                    return;
                }

                #endregion
            }
            else
            {
                #region Player
                msg = "Restarting Match...";
                TournamentMatch tm = GetCurrentPlayerInProgressMatch();

                if (tm == null)
                {
                    MessageForm.Error(this.ParentForm, MsgE.ErrorTournamentMatchNotInprogress, "");
                    return;
                }

                matchIDs       = tm.TournamentMatchID.ToString();
                senderUserID   = Ap.CurrentUserID;
                receiverUserID = tm.OpponentUserID(Ap.CurrentUserID);

                if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmRestartTournamentMatch) != DialogResult.Yes)
                {
                    return;
                }

                if (Ap.Game != null)
                {
                    Ap.Game.Pause();
                }
                #endregion
            }

            frmProgress = ProgressForm.Show(this, msg);

            SocketClient.RestartGame(this.Tournament.TournamentID, matchIDs, tournamentDirectorID, senderUserID, receiverUserID, ResetGameE.Asked, isFromLastMove, string.Empty);
            if (Ap.Game != null && Ap.Game.GameId.Length > 0)
            {
                ChatClient.Write(ChatTypeE.GameWindow, ChatMessageTypeE.Info, ChatTypeE.GameWindow, MsgE.InfoTournamentMatchRestartRequest, Convert.ToInt32(Ap.Game.GameId));
            }

            frmProgress.Close();

            RefreshGrid();
        }
Esempio n. 27
0
        private void showMessageForm()
        {
            MessageForm mfm = new MessageForm("");

            mfm.Show(this);
        }
Esempio n. 28
0
        // 撤销
        private void barRepeal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!Utils.CheckUser())
            {
                return;
            }
            try
            {
                //获取撤销的数据
                List <string> vinList = new List <string>();
                this.gcCljbxx.DefaultView.PostEditor();
                DataTable dt = (DataTable)this.gcCljbxx.DataSource;
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bool result = false;
                        bool.TryParse(dt.Rows[i]["check"].ToString(), out result);
                        if (result)
                        {
                            string vin = (string)dt.Rows[i]["vin"];
                            vinList.Add(vin);
                        }
                    }
                }
                if (vinList == null || vinList.Count < 1)
                {
                    MessageBox.Show("请选择要撤销的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string     delReason = string.Empty;
                ReasonForm rf        = new ReasonForm();
                Utils.SetFormMid(rf);
                rf.Text = "撤销原因";
                rf.ShowDialog();
                if (rf.DialogResult == DialogResult.OK)
                {
                    pf = new ProcessForm();
                    pf.Show();
                    delReason = rf.Reason;
                    // 撤销
                    List <OperateResult> orList = this.ApplyParamMultiRows(vinList, delReason);

                    // 获取撤销结果
                    List <string>               vinsSucc    = new List <string>();
                    List <NameValuePair>        vinsFail    = new List <NameValuePair>();
                    Dictionary <string, string> dSuccVinVid = new Dictionary <string, string>();
                    Utils.getOperateResultListVins(orList, vinsSucc, vinsFail, dSuccVinVid);

                    string strSucc = "";// "备案号(VIN):返回码(VID)";
                    // 修改本地状态为“3:已撤销”
                    if (vinsSucc.Count > 0)
                    {
                        string strUpdate = "";
                        for (int i = 0; i < vinsSucc.Count; i++)
                        {
                            strUpdate += String.Format(",'{0}'", vinsSucc[i]);
                            strSucc   += String.Format("备案号(VIN):{0},\r反馈码(VID):{1}, \r成功 \r\n", vinsSucc[i], dSuccVinVid[vinsSucc[i]]);
                        }

                        // 删除已撤销数据
                        DelteLocalData(strUpdate.Substring(1));

                        // 刷新当前页面
                        int pageNum = Convert.ToInt32(txtPage.Text.Substring(0, txtPage.Text.LastIndexOf("/")));
                        this.SearchLocal(pageNum);
                    }
                    string strFail = "";
                    if (vinsFail.Count > 0)
                    {
                        for (int i = 0; i < vinsFail.Count; i++)
                        {
                            strFail += String.Format("备案号(VIN):{0},\r反馈码(VID):, \r失败:{1} \r\n", vinsFail[i].Name, vinsFail[i].Value);
                        }
                    }
                    string      summary = string.Format("{0}条申请成功\r\n {1}条申请失败\r\n", vinsSucc.Count, vinsFail.Count);
                    MessageForm mf      = new MessageForm(String.Format("{0}{1} \n{2}", summary, strSucc, strFail));
                    Utils.SetFormMid(mf);
                    mf.Text = "申请撤销结果";
                    mf.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (pf != null)
                {
                    pf.Close();
                }
            }
        }
Esempio n. 29
0
        public override bool DoSave()
        {
            //if (!this.ControlManager.CheckControlValue())
            //{
            //    return false;
            //}
            this.ValidateChildren();

            if (!this.ControlManager.SaveCurrent())
            {
                return(false);
            }

            凭证 pz = this.ControlManager.DisplayManager.CurrentItem as 凭证;

            pz.操作人 = "会计";
            using (var rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <Hd.Model.凭证>() as Feng.NH.INHibernateRepository)
            {
                try
                {
                    rep.BeginTransaction();

                    decimal sum = 0;

                    pz.凭证费用明细 = new List <凭证费用明细>();
                    foreach (Xceed.Grid.DataRow row in grdFymx.DataRows)
                    {
                        decimal je = Feng.Utils.ConvertHelper.ToDecimal(row.Cells["金额"].Value).Value;
                        sum += je;

                        凭证费用明细 pzfymx = new 凭证费用明细();
                        pzfymx.备注       = (string)row.Cells["备注"].Value;
                        pzfymx.金额       = je;
                        pzfymx.凭证       = pz;
                        pzfymx.凭证费用类别编号 = (int?)row.Cells["凭证费用类别"].Value;
                        pzfymx.收付标志     = Hd.Model.收付标志.付;
                        pzfymx.相关人编号    = (string)付款对象.SelectedDataValue;
                        pzfymx.业务类型编号   = (int?)row.Cells["业务分类"].Value;
                        pzfymx.费用项编号    = (string)row.Cells["费用项"].Value;
                        pzfymx.费用       = new List <费用>();
                        pzfymx.结算期限     = (DateTime?)row.Cells["结算期限"].Value;

                        凭证用途分类 ytfl = (凭证用途分类)用途分类.SelectedDataValue;

                        if (ytfl == 凭证用途分类.业务应付)          // 业务应付
                        {
                            pzfymx.业务类型编号 = (int?)业务分类.SelectedDataValue;
                        }
                        else if (ytfl == 凭证用途分类.其他应付)
                        {
                            pzfymx.业务类型编号 = 111;
                            pzfymx.费用项编号  = "002";
                        }
                        else if (ytfl == 凭证用途分类.其他报销)
                        {
                            pzfymx.费用项编号 = (string)row.Cells["费用项"].Value;
                        }
                        else if (ytfl == 凭证用途分类.业务报销)
                        {
                            普通票 piao  = null;
                            普通箱 xiang = null;

                            piao = rep.UniqueResult <Hd.Model.普通票>(NHibernate.Criterion.DetachedCriteria.For <Hd.Model.普通票>()
                                                                   .Add(NHibernate.Criterion.Expression.Eq("货代自编号", row.Cells["自编号"].Value)));

                            if (piao == null)
                            {
                                throw new InvalidUserOperationException("自编号" + (string)row.Cells["自编号"].Value + "输入有误,请重新输入!");
                            }
                            switch (业务分类.SelectedDataValue.ToString())
                            {
                            case "11":
                                using (var rep2 = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <Hd.Model.Jk.进口箱>() as Feng.NH.INHibernateRepository)
                                {
                                    if (row.Cells["箱号"].Value != null)
                                    {
                                        xiang = rep2.UniqueResult <Hd.Model.Jk.进口箱>(NHibernate.Criterion.DetachedCriteria.For <Hd.Model.Jk.进口箱>()
                                                                                    .Add(NHibernate.Criterion.Expression.Eq("箱号", row.Cells["箱号"].Value))
                                                                                    .CreateCriteria("票")
                                                                                    .Add(NHibernate.Criterion.Expression.Eq("货代自编号", row.Cells["自编号"].Value)));

                                        if (xiang == null)
                                        {
                                            throw new InvalidUserOperationException("箱号" + (string)row.Cells["箱号"].Value + "输入有误,请重新输入!");
                                        }
                                    }
                                }
                                break;

                            case "15":
                                using (var rep2 = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <Hd.Model.Jk.进口箱>() as Feng.NH.INHibernateRepository)
                                {
                                    //piao = rep2.Session.CreateCriteria<Hd.Model.普通票>()
                                    //        .Add(NHibernate.Criterion.Expression.Eq("货代自编号", row.Cells["自编号"].Value))
                                    //        .UniqueResult<Hd.Model.普通票>();
                                    //if (piao == null)
                                    //{
                                    //    throw new InvalidUserOperationException("自编号" + (string)row.Cells["自编号"].Value + "输入有误,请重新输入!");
                                    //}
                                    if (row.Cells["箱号"].Value != null)
                                    {
                                        xiang = rep2.UniqueResult <Hd.Model.Nmcg.内贸出港箱>(NHibernate.Criterion.DetachedCriteria.For <Hd.Model.Nmcg.内贸出港箱>()
                                                                                        .Add(NHibernate.Criterion.Expression.Eq("箱号", row.Cells["箱号"].Value))
                                                                                        .CreateCriteria("票")
                                                                                        .Add(NHibernate.Criterion.Expression.Eq("货代自编号", row.Cells["自编号"].Value)));

                                        if (xiang == null)
                                        {
                                            throw new InvalidUserOperationException("箱号" + (string)row.Cells["箱号"].Value + "输入有误,请重新输入!");
                                        }
                                    }
                                }
                                break;

                            case "45":
                                using (var rep2 = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <Hd.Model.Jk.进口票>() as Feng.NH.INHibernateRepository)
                                {
                                    //piao = rep2.Session.CreateCriteria<Hd.Model.普通票>()
                                    //        .Add(NHibernate.Criterion.Expression.Eq("货代自编号", row.Cells["自编号"].Value))
                                    //        .UniqueResult<Hd.Model.普通票>();
                                    //if (piao == null)
                                    //{
                                    //    throw new InvalidUserOperationException("自编号" + (string)row.Cells["自编号"].Value + "输入有误,请重新输入!");
                                    //}
                                    if (row.Cells["箱号"].Value != null)
                                    {
                                        xiang = rep2.UniqueResult <Hd.Model.Jk2.进口其他业务箱>(NHibernate.Criterion.DetachedCriteria.For <Hd.Model.Jk2.进口其他业务箱>()
                                                                                         .Add(NHibernate.Criterion.Expression.Eq("箱号", row.Cells["箱号"].Value))
                                                                                         .CreateCriteria("票")
                                                                                         .Add(NHibernate.Criterion.Expression.Eq("货代自编号", row.Cells["自编号"].Value)));

                                        if (xiang == null)
                                        {
                                            throw new InvalidUserOperationException("箱号" + (string)row.Cells["箱号"].Value + "输入有误,请重新输入!");
                                        }
                                    }
                                }
                                break;

                            default:
                                throw new ArgumentException("不合理的业务类型分类!");
                            }

                            NHibernate.Criterion.DetachedCriteria cri = NHibernate.Criterion.DetachedCriteria.For <业务费用>()
                                                                        .Add(NHibernate.Criterion.Expression.Eq("票.ID", piao.ID))
                                                                        .Add(NHibernate.Criterion.Expression.Eq("费用项编号", row.Cells["费用项"].Value))
                                                                        .Add(NHibernate.Criterion.Expression.Eq("收付标志", Hd.Model.收付标志.付));
                            if (xiang != null)
                            {
                                cri = cri.Add(NHibernate.Criterion.Expression.Eq("箱.ID", xiang.ID));
                            }
                            else
                            {
                                cri = cri.Add(NHibernate.Criterion.Expression.IsNull("箱"));
                            }

                            IList <业务费用> list = rep.List <业务费用>(cri);


                            cri = NHibernate.Criterion.DetachedCriteria.For <费用信息>()
                                  .Add(NHibernate.Criterion.Expression.Eq("票.ID", piao.ID))
                                  .Add(NHibernate.Criterion.Expression.Eq("费用项编号", row.Cells["费用项"].Value));
                            IList <费用信息> fyxxs = rep.List <费用信息>(cri);
                            if (fyxxs.Count > 0)
                            {
                                if (!fyxxs[0].完全标志付)
                                {
                                    fyxxs[0].完全标志付 = true;
                                    (new HdBaseDao <费用信息>()).Update(rep, fyxxs[0]);
                                }
                                else
                                {
                                    throw new InvalidUserOperationException("货代自编号" + piao.货代自编号 + "费用项" + row.Cells["费用项"].Value.ToString()
                                                                            + "已打完全标志,不能修改费用!");
                                }
                            }
                            bool exist = false;
                            if (list.Count > 0)
                            {
                                foreach (业务费用 i in list)
                                {
                                    if (i.金额 == je && i.相关人编号 == pzfymx.相关人编号 && i.凭证费用明细 == null)
                                    {
                                        i.凭证费用明细 = pzfymx;
                                        (new 业务费用Dao()).Update(rep, i);
                                        pzfymx.费用.Add(i);

                                        exist = true;
                                        break;
                                    }
                                }
                            }
                            if (!exist)
                            {
                                if (list.Count > 1)
                                {
                                    throw new InvalidUserOperationException("货代自编号" + piao.货代自编号 + "费用项" + row.Cells["费用项"].Value.ToString()
                                                                            + "已存在多条费用,且无费用金额一致,请先修改一致!");
                                }
                                else if (list.Count == 0)
                                {
                                    业务费用 fy = new 业务费用();
                                    fy.备注     = (string)row.Cells["备注"].Value;
                                    fy.费用实体   = piao;
                                    fy.费用项编号  = (string)row.Cells["费用项"].Value;
                                    fy.金额     = Feng.Utils.ConvertHelper.ToDecimal(row.Cells["金额"].Value).Value;
                                    fy.票      = piao;
                                    fy.凭证费用明细 = pzfymx;
                                    fy.收付标志   = Hd.Model.收付标志.付;
                                    fy.相关人编号  = (string)付款对象.SelectedDataValue;
                                    if (xiang != null)
                                    {
                                        fy.箱   = xiang;
                                        fy.箱Id = xiang.ID;
                                    }
                                    (new 业务费用Dao()).Save(rep, fy);
                                    pzfymx.费用.Add(fy);
                                }
                                else// if (list.Count == 1)
                                {
                                    if (list[0].相关人编号 == pzfymx.相关人编号 && list[0].凭证费用明细 == null)
                                    {
                                        if (MessageForm.ShowYesNo("货代自编号" + piao.货代自编号 + "费用项" + row.Cells["费用项"].Value.ToString()
                                                                  + "已存在费用,且费用金额不符,是否添加调节款?", "确认"))
                                        {
                                            调节业务款 tjk = new 调节业务款();
                                            tjk.备注     = (string)row.Cells["备注"].Value;
                                            tjk.费用实体   = piao;
                                            tjk.费用项编号  = (string)row.Cells["费用项"].Value;
                                            tjk.金额     = Feng.Utils.ConvertHelper.ToDecimal(row.Cells["金额"].Value).Value;
                                            tjk.票      = piao;
                                            tjk.凭证费用明细 = pzfymx;
                                            tjk.收付标志   = Hd.Model.收付标志.付;
                                            tjk.相关人编号  = (string)付款对象.SelectedDataValue;
                                            if (xiang != null)
                                            {
                                                tjk.箱   = xiang;
                                                tjk.箱Id = xiang.ID;
                                            }
                                            (new 费用Dao()).Save(rep, tjk);
                                            pzfymx.费用.Add(tjk);
                                        }
                                        else
                                        {
                                            throw new InvalidUserOperationException("请重新填写货代自编号!");
                                        }
                                    }
                                    else
                                    {
                                        throw new InvalidUserOperationException("货代自编号" + piao.货代自编号 + "费用项" + row.Cells["费用项"].Value.ToString()
                                                                                + "已存在的一条费用相关人不符或已经出国凭证,请先修改一致!");
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new ArgumentException("不合理的凭证用途分类!");
                        }
                        pz.凭证费用明细.Add(pzfymx);
                    }

                    pz.会计编号    = SystemConfiguration.UserName;
                    pz.会计金额    = sum;
                    pz.金额.币制编号 = "CNY";
                    pz.金额.数额   = pz.会计金额;
                    pz.凭证类别    = 凭证类别.付款凭证;
                    pz.相关人编号   = (string)付款对象.SelectedDataValue;
                    pz.自动手工标志  = 自动手工标志.手工;

                    (new 凭证Dao()).Save(rep, pz);

                    foreach (凭证费用明细 pzfymx in pz.凭证费用明细)
                    {
                        (new HdBaseDao <凭证费用明细>()).Save(rep, pzfymx);
                    }

                    (new 凭证Dao()).Submit(rep, pz);

                    rep.CommitTransaction();

                    if (this.ControlManager.ControlCheckExceptionProcess != null)
                    {
                        this.ControlManager.ControlCheckExceptionProcess.ClearAllError();
                    }
                    this.ControlManager.State = StateType.View;
                    this.ControlManager.OnCurrentItemChanged();

                    // don't save to database
                    this.ControlManager.EndEdit(false);

                    return(true);
                }
                catch (Exception ex)
                {
                    rep.RollbackTransaction();
                    ServiceProvider.GetService <IExceptionProcess>().ProcessWithNotify(ex);
                    return(false);
                }
            }
        }
        void save(object sender, EventArgs e)
        {
            try
            {
                ushort v;

                //if (!ushort.TryParse(ServerDefaultPort.Text, out v))
                //    throw new Exception("Server port must be an integer between 0 and " + ushort.MaxValue);
                //general.TcpClientDefaultPort = v;

                if (string.IsNullOrWhiteSpace(ServerDefaultIp.Text))
                {
                    throw new Exception("Default server ip is not specified.");
                }
                IPAddress ia;
                if (!IPAddress.TryParse(ServerDefaultIp.Text, out ia))
                {
                    throw new Exception("Default server ip is not a valid value.");
                }
                general.TcpClientDefaultIp = ia.ToString();

                if (!ushort.TryParse(ClientPort.Text, out v))
                {
                    throw new Exception("Client port must be an between 0 and " + ushort.MaxValue);
                }
                general.TcpServerPort = v;

                if (string.IsNullOrWhiteSpace(ServiceDomain.Text))
                {
                    throw new Exception("Service domian is not specified.");
                }
                general.ServiceDomain = ServiceDomain.Text.Trim();

                if (string.IsNullOrWhiteSpace(ServiceType.Text))
                {
                    throw new Exception("Service type is not specified.");
                }
                general.ServiceType = ServiceType.Text.Trim();

                if (Monitors.SelectedIndex < 0)
                {
                    throw new Exception("Captured Video Source is not specified.");
                }
                general.CapturedMonitorDeviceName = (string)Monitors.SelectedValue;

                general.ShowMpegWindow = ShowMpegWindow.IsChecked ?? false;

                general.WriteMpegOutput2Log = WriteMpegOutput2Log.IsChecked ?? false;

                //general.CapturedMonitorRectangle = MonitorRoutines.GetMonitorAreaByMonitorName(general.CapturedMonitorDeviceName);
                //if (general.CapturedMonitorRectangle == null)
                //    throw new Exception("Could not get rectangle for monitor '" + general.CapturedMonitorDeviceName + "'");
                general.CapturedMonitorRectangle = null;

                general.DeleteLogsOlderDays = int.Parse(DeleteLogsOlderDays.Text);

                UiApiClient.SaveServiceSettings(general);

                if (Settings.View.DeleteLogsOlderDays != general.DeleteLogsOlderDays)
                {
                    Settings.View.DeleteLogsOlderDays = general.DeleteLogsOlderDays;
                    Settings.View.Save();
                }

                System.ServiceProcess.ServiceControllerStatus?status = UiApiClient.GetServiceStatus();
                if (status != null && status != System.ServiceProcess.ServiceControllerStatus.Stopped &&
                    (ProcessRoutines.ProcessIsSystem() ||/*used for configuration during installing*/
                     Message.YesNo("The changes have been saved and will be engaged after service restart. Would you like to restart the service (all the present connections if any, will be terminated)?")
                    )
                    )
                {
                    MessageForm mf = null;
                    ThreadRoutines.StartTry(() =>
                    {
                        mf = new MessageForm(System.Windows.Forms.Application.ProductName, System.Drawing.SystemIcons.Information, "Resetting the service. Please wait...", null, 0, null);
                        mf.ShowDialog();
                    });

                    UiApiClient.StartStopService(false);
                    UiApiClient.StartStopService(true);

                    if (null == SleepRoutines.WaitForObject(() => { return(mf); }, 1000))
                    {
                        throw new Exception("Could not get MessageForm");
                    }
                    mf.Invoke(() => { mf.Close(); });
                }

                Close();
            }
            catch (Exception ex)
            {
                Message.Exclaim(ex.Message);
            }
        }
Esempio n. 31
0
		private void onMessageStanzaReceived(MessageStanza s)
		{
			// Get or create a chat window and show the message
			MessageForm msgf = null;
			if(chats[s.From] != null)
			{
				msgf = (MessageForm)chats[s.From];
			}
			else
			{
				msgf = new MessageForm(this.session, "Title", s.From, s.Language, s.ThreadID);
				chats[s.From] = msgf;
			}
			msgf.NewMessage(s);
			msgf.Show();
		}
Esempio n. 32
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Get sourceURL from textbox
            Uri    fileurl  = new Uri(textBox_URL.Text);
            string filename = Path.GetFileName(textBox_URL.Text);
            string str      = filename.Remove(filename.Length - 4);

            //Create Form to display messages
            Form message = new MessageForm();

            message.Text = "Cerberus Says";
            TextBox messageTextbox = new TextBox();

            messageTextbox.SetBounds(0, 0, 380, 270);
            messageTextbox.Font          = new Font("Sitka Text", 12f);
            messageTextbox.Multiline     = true;
            messageTextbox.AcceptsReturn = true;
            messageTextbox.ScrollBars    = ScrollBars.Vertical;
            messageTextbox.ReadOnly      = true;


            message.ClientSize = messageTextbox.Size;
            message.Controls.Add(messageTextbox);
            message.Show(this);

            Process p = new Process();

            p.StartInfo.FileName         = "cmd.exe";
            p.StartInfo.WorkingDirectory = @"C:/Users/320074769/Downloads/Cerberus";
            p.StartInfo.UseShellExecute  = false;
            p.StartInfo.CreateNoWindow   = true;

            //Process to download the code using URL
            p.StartInfo.Arguments = "/C" + " git clone " + textBox_URL.Text;
            p.Start();
            p.WaitForExit();

            messageTextbox.AppendText("Got your Code base...\n\n");
            messageTextbox.AppendText("Analysing Code...\n\n");
            messageTextbox.AppendText("Few Moments Please...\n\n");

            //Process to run jscpd tool on cod base
            p.StartInfo.Arguments = "/C" + " jscpd --min-tokens 50 --reporters" + " html,verbose" + " --output" + " C:\\Users\\320074769\\Downloads\\Cerberus" + " --mode" + " strict" + " C:\\Users\\320074769\\Downloads\\Cerberus\\" + str;
            p.Start();
            p.WaitForExit();

            //Process to remove code base
            p.StartInfo.Arguments = "/C" + " RD /S /Q" + " C:\\Users\\320074769\\Downloads\\Cerberus\\" + str;
            p.Start();
            p.WaitForExit();

            //Process to rename the report with epoch time stamp and repository name
            p.StartInfo.WorkingDirectory = @"C:/Users/320074769/Downloads/Cerberus";
            string result = DateTimeOffset.Now.ToUnixTimeSeconds() + "-" + str + "-jscpd-report.html";

            p.StartInfo.Arguments = "/C ren " + "jscpd-report.html " + result;
            p.Start();
            p.WaitForExit();

            messageTextbox.AppendText("Here is your report...\n\n");
            message.Close();

            //Process to open the report
            p.StartInfo.Arguments = "/C start " + result;
            p.Start();
            p.WaitForExit();
        }
Esempio n. 33
0
 static void show_blocking_dialog()
 {
     MessageForm mf2 = new MessageForm(
                        Caption,
                        "Please close all message boxes opened by this application, before using this form.",
                        null,
                        new string[1] { "OK" },
                        0,
                        null,
                        SystemIcons.Exclamation
                        );
     preset(mf2);
     mf2.GetAnswer();
 }
Esempio n. 34
0
        private void button2_Click(object sender, EventArgs e)
        {
            string eventlog = "set a Document for a NationalityCode=" + txtNationalityCode.Text;

            try
            {
                if (txtNationalityCode.Text == string.Empty)
                {
                    var msg = "لطفا کد ملی را وارد نمایید";
                    MessageForm.Show(msg, "ثبت", MessageFormIcons.Warning, MessageFormButtons.Ok, Properties.Settings.Default.Color);

                    txtNationalityCode.Focus(); return;
                }
                //           if(pictureBox1.Image!= null)// if(dataViewImages.Rows.Count>0)
                Insert();
                int result = da.InsertPatient("SetCostumerInfo", txtNationalityCode.Text, txtName.Text, txtLastName.Text, txtFather.Text, txtAdress.Text, txtisurance.Text, txtTel.Text, txtMobile.Text);
                if (result > 0)
                {
                    var msg = "ثبت با موفقیت انجام شد";
                    MessageForm.Show(msg, "ثبت", MessageFormIcons.Info, MessageFormButtons.Ok, Properties.Settings.Default.Color);

                    button4.Enabled            = false;
                    txtAdress.Enabled          = false;
                    txtFather.Enabled          = false;
                    txtisurance.Enabled        = false;
                    txtLastName.Enabled        = false;
                    txtMobile.Enabled          = false;
                    txtName.Enabled            = false;
                    txtTel.Enabled             = false;
                    txtNationalityCode.Enabled = false;
                    btnAttach.Enabled          = false; btnshenas.Enabled = false; btnKartmelli.Enabled = false; btnBimeh.Enabled = false; button2.Enabled = false;
                    if (bimehF)
                    {
                        btnBimeh.Image = Properties.Resources.check;
                    }
                    if (kartmelliF)
                    {
                        btnKartmelli.Image = Properties.Resources.check;
                    }
                    if (shenasnameF)
                    {
                        btnshenas.Image = Properties.Resources.check;
                    }
                    if (attachF)
                    {
                        btnAttach.Image = Properties.Resources.check;
                    }
                }
                else
                {
                    var msg = "ثبت ناموفق بود";
                    MessageForm.Show(msg, "ثبت", MessageFormIcons.Warning, MessageFormButtons.Ok, Properties.Settings.Default.Color);

                    // timer1.Start();
                }
            }
            catch (Exception e1)
            {
                NewMethod_eventlog(eventlog, 17000);
                throw;
            }
        }
Esempio n. 35
0
 private void button3_Click(object sender, EventArgs e)
 {
     MessageForm.Show(this, MsgE.InfoCommingShortly);
 }
Esempio n. 36
0
        private void Insert()
        {
            XmlDocument doc = new XmlDocument();

            List <DocumentsImages> documentsImages = new List <DocumentsImages>();
            ImageConverter         converter       = new ImageConverter();

            DocumentsImages documentsImage = new DocumentsImages();

            //Image img = pictureBox1.Image as Image;
            //byte[] buf = null;
            //if (img != null)
            //{
            //    using (MemoryStream s = new MemoryStream())
            //    {
            //        img.Save(s, ImageFormat.Png);
            //        buf = s.ToArray();
            //    }
            //}

            //  path = fileDialog.FileName;

            //FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);

            //byte[] picArray = new byte[fs.Length];

            Image imgBimeh    = pictureBox4.Image;
            Image img         = pictureBox1.Image;
            Image imgShenas   = pictureBox2.Image;
            Image imgKartMell = pictureBox3.Image;

            if (customerImage != null)
            {
                img = Image.FromFile(customerImage);
                documentsImage.Image = (byte[])converter.ConvertTo(img, typeof(byte[]));

                attachF = true;
            }
            if (bimesh != null)
            {
                imgBimeh             = Image.FromFile(bimesh);
                documentsImage.Bimeh = (byte[])converter.ConvertTo(imgBimeh, typeof(byte[]));
                bimehF = true;
            }
            if (shenasnameh != null)
            {
                imgShenas = Image.FromFile(shenasnameh);
                documentsImage.Shenasname = (byte[])converter.ConvertTo(imgShenas, typeof(byte[]));
                shenasnameF = true;
            }
            if (kartMelli != null)
            {
                imgKartMell = Image.FromFile(kartMelli);
                documentsImage.KartMelli = (byte[])converter.ConvertTo(imgKartMell, typeof(byte[]));
                kartmelliF = true;
            }
            documentsImage.NationalityCode = txtNationalityCode.Text;
            documentsImage.IdDocumentImage = 0;//Convert.ToInt32(dataViewImages.CurrentRow.Tag) == 0 ? 0 : Convert.ToInt32(dataViewImages.CurrentRow.Tag);
            documentsImages.Add(documentsImage);

            //    }
            //}



            string xml = "<DocumentsImages>";

            if (documentsImages != null && documentsImages.Count > 0)
            {
                foreach (DocumentsImages lr in documentsImages)
                {
                    xml += string.Format(@"<DocumentsImages idDocumentImage=""{0}"" NationalityCode=""{1}"" Customerimage=""{2}""",
                                         lr.IdDocumentImage,
                                         lr.NationalityCode.Trim(),
                                         (byte[])converter.ConvertTo((img), typeof(byte[])));

                    xml += "  />";
                }
            }

            xml         += "</DocumentsImages>";
            doc.InnerXml = xml;


            SqlParameter[] param;
            param = new SqlParameter[10];
            bool result;
            int  index = 0;

            //if (!String.IsNullOrEmpty(xml))
            param[index++] = new SqlParameter("@idDocumentImage", 0);
            param[index++] = new SqlParameter("@NationalityCode", txtNationalityCode.Text.Trim());
            // param[index++] = new SqlParameter("@OverallInsertFieldCount", overallInsertFieldCount);

            if (attachF)
            {
                param[index++] = new SqlParameter("@Customerimage", (byte[])converter.ConvertTo(img, typeof(byte[])));
            }

            if (bimehF)
            {
                param[index++] = new SqlParameter("@Bimeh", (byte[])converter.ConvertTo(imgBimeh, typeof(byte[])));
            }

            if (shenasnameF)
            {
                param[index++] = new SqlParameter("@ShenasName", (byte[])converter.ConvertTo(imgShenas, typeof(byte[])));
            }

            if (kartmelliF)
            {
                param[index++] = new SqlParameter("@KartMelli", (byte[])converter.ConvertTo(imgKartMell, typeof(byte[])));
            }

            param[index++] = new SqlParameter("@attachF", attachF);
            param[index++] = new SqlParameter("@bimehF", bimehF);
            param[index++] = new SqlParameter("@shenasnameF", shenasnameF);
            param[index++] = new SqlParameter("@kartmelliF", kartmelliF);

            result = Convert.ToBoolean(this.da.ExecuteScalarSP("SetDocumentsImagesInfos", param));
            if (result)
            {
                // var msg = "ثبت با موفقیت انجام شد"; MessageForm.Show(msg, "ثبت", MessageFormIcons.Info, MessageFormButtons.Ok, Properties.Settings.Default.Color);
            }
            else
            {
                var msg = "ثبت عکس ناموفق بود."; MessageForm.Show(msg, "ثبت", MessageFormIcons.Info, MessageFormButtons.Ok, Properties.Settings.Default.Color);
            }
        }
Esempio n. 37
0
 //meta! userInfo="Removed from model"
 public void ProcessNastupenie(MessageForm message)
 {
 }
Esempio n. 38
0
        private void button4_Click_1(object sender, EventArgs e)
        {
            if (txtNationalityCode.Text == string.Empty)
            {
                var msg = "لطفا کد ملی را وارد نمایید";
                MessageForm.Show(msg, "ثبت", MessageFormIcons.Warning, MessageFormButtons.Ok, Properties.Settings.Default.Color);

                txtNationalityCode.Focus(); return;
            }

            SqlParameter[] param;
            param = new SqlParameter[2];
            int index = 0;

            param[index++] = new SqlParameter("@DepartmentID", DepartmentID);
            param[index++] = new SqlParameter("@NationalityCode", txtNationalityCode.Text.Trim());
            DataSet nobatDS = new DataSet();

            nobatDS = da.ExecuteSP("SetIntermittenceHandly", param);
            if (Convert.ToInt32(nobatDS.Tables[0].Rows[0][0]) == -2)

            {
                var msg = "ظرفیت نوبت دهی امروز، برای بخش انتخابی تمام شده است.";
                MessageForm.Show(msg, "خطا", MessageFormIcons.Warning, MessageFormButtons.Ok, Properties.Settings.Default.Color);

                // if user choose yes we add item
                // if setting configured by admin


                DialogResult dialogResult = MessageBox.Show("نوبت خارج از صف", "آیا شما با ثبت این نوبت برای این بخش خارج از صف استاندارد موافق هستید؟", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    //do something
                    // متاسفانه مدیر شما موافق نیست.



                    //
                    SqlParameter[] param2;
                    param2 = new SqlParameter[2];
                    int index2 = 0;
                    param2[index2++] = new SqlParameter("@DepartmentID", DepartmentID);
                    param2[index2++] = new SqlParameter("@NationalityCode", txtNationalityCode.Text.Trim());
                    DataSet nobatDS2 = new DataSet();
                    nobatDS = da.ExecuteSP("SetIntermittenceHandlyInsert", param);
                }
                else if (dialogResult == DialogResult.No)
                {
                    //do something else
                }
            }
            else if (Convert.ToInt32(nobatDS.Tables[0].Rows[0][0]) == 1)
            {
                var msg = " نوبت در ساعت  " + nobatDS.Tables[1].Rows[0][0].ToString().Substring(0, 5) + " با موفقیت ثبت شد. ";
                MessageForm.Show(msg, "خطا", MessageFormIcons.Warning, MessageFormButtons.Ok, Properties.Settings.Default.Color);
                button4.Enabled = false;
            }
            else if (Convert.ToInt32(nobatDS.Tables[0].Rows[0][0]) == 0)
            {
                var msg = "ثبت نوبت ناموفق بود.";
                MessageForm.Show(msg, "خطا", MessageFormIcons.Warning, MessageFormButtons.Ok, Properties.Settings.Default.Color);
            }
        }
Esempio n. 39
0
 //上报已修改的信息
 private void barUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (!Utils.CheckUser())
     {
         return;
     }
     try
     {
         //获取上报修改的数据
         List <string> vinList = new List <string>();
         this.gcCLJBXX.DefaultView.PostEditor();
         DataTable dt = (DataTable)this.gcCLJBXX.DataSource;
         if (dt != null && dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 bool result = false;
                 bool.TryParse(dt.Rows[i]["check"].ToString(), out result);
                 if (result)
                 {
                     string vin = String.Format("'{0}'", dt.Rows[i]["vin"]);
                     vinList.Add(vin);
                 }
             }
         }
         if (vinList == null || vinList.Count < 1)
         {
             MessageBox.Show("请选择要上报修改的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         ReasonForm rf = new ReasonForm();
         Utils.SetFormMid(rf);
         rf.Text = "修改原因";
         rf.ShowDialog();
         if (rf.DialogResult == DialogResult.OK)
         {
             pf = new ProcessForm();
             pf.Show();
             // 发出修改
             List <OperateResult> orList = ApplyParamMultiRows(vinList, rf.Reason);
             // 获取修改结果
             List <string>               vinsSucc    = new List <string>();
             List <NameValuePair>        vinsFail    = new List <NameValuePair>();
             Dictionary <string, string> dSuccVinVid = new Dictionary <string, string>();
             Utils.getOperateResultListVins(orList, vinsSucc, vinsFail, dSuccVinVid);
             string strSucc = "";// "备案号(VIN):返回码(VID)";
             // 修改本地状态为“0:已上报”
             if (vinsSucc.Count > 0)
             {
                 string strUpdate = "";
                 for (int i = 0; i < vinsSucc.Count; i++)
                 {
                     strUpdate += String.Format(",'{0}'", vinsSucc[i]);
                     strSucc   += String.Format("备案号(VIN):{0},\r反馈码(VID):{1}, \r成功 \r\n", vinsSucc[i], dSuccVinVid[vinsSucc[i]]);
                 }
                 //// 反馈码入库
                 Utils.setVidStatusForUpload(dSuccVinVid);
                 // 刷新当前页面
                 this.refrashCurrentPage();
             }
             string strFail = "";
             if (vinsFail.Count > 0)
             {
                 for (int i = 0; i < vinsFail.Count; i++)
                 {
                     strFail += String.Format("备案号(VIN):{0}, \r失败:\r\n{1} \r\n", vinsFail[i].Name, vinsFail[i].Value);
                 }
             }
             string      summary = string.Format("{0}条申请成功\r\n {1}条申请失败\r\n", vinsSucc.Count, vinsFail.Count);
             MessageForm mf      = new MessageForm(String.Format("{0}{1} \n{2}", summary, strSucc, strFail));
             Utils.SetFormMid(mf);
             mf.Text = "申请修改结果";
             mf.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         if (pf != null)
         {
             pf.Close();
         }
     }
 }
Esempio n. 40
0
        protected void ImportMainData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            NissanUtils  utils      = new NissanUtils();
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path;

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.MainFileName);
                    if (fileNameList.Count > 0)
                    {
                        string        fileNameMsg    = string.Empty;
                        string        returnMsg      = string.Empty;
                        List <string> mainUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + Environment.NewLine;

                            // 导入filename文件信息
                            returnMsg += utils.ImportMainData(fileName, folderPath, importType, mainUpdateList);
                        }

                        if (string.IsNullOrEmpty(returnMsg))
                        {
                            MessageForm mf = new MessageForm(String.Format("以下文件{0}成功:\r\n{1}", operateType, fileNameMsg));
                            Utils.SetFormMid(mf);
                            mf.Text = operateType + "成功";
                            mf.ShowDialog();
                        }
                        else
                        {
                            MessageForm mf = new MessageForm(returnMsg);
                            Utils.SetFormMid(mf);
                            mf.Text = operateType + "结果";
                            mf.ShowDialog();
                        }

                        if (importType == "IMPORT")
                        {
                            this.ShowMainData();
                        }
                        else if (importType == "UPDATE")
                        {
                            this.ShowUpdatedMainData(mainUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show(String.Format("目录{0}下没有文件{1}", folderPath, utils.MainFileName));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("{0}失败:{1}", operateType, ex.Message), "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 override public void Execute(MessageForm message)
 {
 }
Esempio n. 42
0
        public static void LaunchQuest(Player _player, int _difficulty)
        {
            int quest;

            #region Very Easy Quests

            if (_difficulty == -4)
            {
                quest = r.Next(0, 6);

                switch (quest)
                {
                case 0:
                    _player.CurrentQuest = new VeryEasyDefeat5();
                    break;

                case 1:
                    _player.CurrentQuest = new VeryEasyHealing();
                    break;

                case 2:
                    _player.CurrentQuest = new VeryEasyDamage();
                    break;

                case 3:
                    _player.CurrentQuest = new VeryEasyClass();
                    break;

                case 4:
                    _player.CurrentQuest = new VeryEasyPercentRemaining();
                    break;

                case 5:
                    _player.CurrentQuest = new VeryEasyNPCType();
                    break;

                default:
                    break;
                }
            }

            #endregion

            #region Easy Quests

            if (_difficulty == -2)
            {
                quest = r.Next(0, 6);

                switch (quest)
                {
                case 0:
                    _player.CurrentQuest = new EasyDefeat5();
                    break;

                case 1:
                    _player.CurrentQuest = new EasyHealing();
                    break;

                case 2:
                    _player.CurrentQuest = new EasyDamage();
                    break;

                case 3:
                    _player.CurrentQuest = new EasyClass();
                    break;

                case 4:
                    _player.CurrentQuest = new EasyPercentRemaining();
                    break;

                case 5:
                    _player.CurrentQuest = new EasyNPCType();
                    break;

                default:
                    break;
                }
            }

            #endregion

            #region NormalQuests

            if (_difficulty == 0)
            {
                quest = r.Next(0, 6);

                switch (quest)
                {
                case 0:
                    _player.CurrentQuest = new NormalDefeat5();
                    break;

                case 1:
                    _player.CurrentQuest = new NormalHealing();
                    break;

                case 2:
                    _player.CurrentQuest = new NormalDamage();
                    break;

                case 3:
                    _player.CurrentQuest = new NormalClass();
                    break;

                case 4:
                    _player.CurrentQuest = new NormalPercentRemaining();
                    break;

                case 5:
                    _player.CurrentQuest = new NormalNPCType();
                    break;

                default:
                    break;
                }
            }

            #endregion

            #region Hard Quests

            if (_difficulty == 2)
            {
                quest = r.Next(0, 6);

                switch (quest)
                {
                case 0:
                    _player.CurrentQuest = new HardDefeat5();
                    break;

                case 1:
                    _player.CurrentQuest = new HardHealing();
                    break;

                case 2:
                    _player.CurrentQuest = new HardDamage();
                    break;

                case 3:
                    _player.CurrentQuest = new HardClass();
                    break;

                case 4:
                    _player.CurrentQuest = new HardPercentRemaining();
                    break;

                case 5:
                    _player.CurrentQuest = new HardNPCType();
                    break;

                default:
                    break;
                }
            }

            #endregion

            #region Very Hard Quests

            if (_difficulty == 4)
            {
                quest = r.Next(0, 6);

                switch (quest)
                {
                case 0:
                    _player.CurrentQuest = new VeryHardDefeat5();
                    break;

                case 1:
                    _player.CurrentQuest = new VeryHardHealing();
                    break;

                case 2:
                    _player.CurrentQuest = new VeryHardDamage();
                    break;

                case 3:
                    _player.CurrentQuest = new VeryHardClass();
                    break;

                case 4:
                    _player.CurrentQuest = new VeryHardPercentRemaining();
                    break;

                case 5:
                    _player.CurrentQuest = new VeryHardNPCType();
                    break;

                default:
                    break;
                }
            }

            #endregion

            _player.CurrentQuest.InitiateQuest(_player);
            MessageForm mes = new MessageForm("You have been given a new quest! " + Environment.NewLine + _player.CurrentQuest.QuestText);
            mes.ShowDialog();
        }
Esempio n. 43
0
        public static void GiveVeryHardQuestReward(Player _player, EnumQuestRewardType _rewardType)
        {
            int         xpReward   = 0;
            Item        itemReward = new Item();
            int         dustReward = 0;
            MessageForm mes        = new MessageForm("");
            Random      r          = new Random();

            switch (_rewardType)
            {
            case EnumQuestRewardType.Experience:
                foreach (var item in _player.ControlledCharacters)
                {
                    xpReward = (int)(item.CharXPToLevel * 0.25);
                    item.CharRecieveXP(xpReward);
                    mes = new MessageForm(item.UnitName + " received " + xpReward + " experience!");
                    mes.ShowDialog();
                }
                break;

            case EnumQuestRewardType.Item:

                for (int i = 0; i < 2; i++)
                {
                    int temp   = r.Next(0, 101);
                    int ilevel = _player.ControlledCharacters[r.Next(0, _player.ControlledCharacters.Count)].UnitLevel + 4;
                    if (ilevel < 1)
                    {
                        ilevel = 1;
                    }

                    if (temp >= 70 && ilevel > 10)
                    {
                        itemReward = ItemGeneration.ReturnEpocalItem(ilevel);
                    }
                    else
                    {
                        itemReward = ItemGeneration.GenerateFabledItem(ilevel);
                    }

                    _player.AddItemToInventory(itemReward);
                    mes = new MessageForm("You received an " + itemReward.ItemQuality + " item:" + Environment.NewLine + itemReward.ItemName);
                    mes.ShowDialog();
                }

                break;

            case EnumQuestRewardType.Dust:
                foreach (var item in _player.ControlledCharacters)
                {
                    dustReward += (int)(item.UnitLevel * 5);
                }
                mes           = new MessageForm("You received a total of " + dustReward + " Dust!");
                _player.Dust += dustReward;
                mes.ShowDialog();
                break;

            default:
                break;
            }
        }
Esempio n. 44
0
        static int show_dialog(string title, Icon icon, string message, string[] buttons, int default_button, Form owner, bool? button_autosize = null, bool? no_duplicate = null)
        {
            string caller = null;
            if (no_duplicate ?? NoDuplicate)
            {
                StackTrace st = new StackTrace(true);
                StackFrame sf = null;
                for (int i = 1; i < st.FrameCount; i++)
                {
                    sf = st.GetFrame(i);
                    string file_name = sf.GetFileName();
                    if (file_name == null || !Regex.IsMatch(file_name, @"\\Message\.cs$"))
                        break;
                }
                caller = sf.GetMethod().Name + "," + sf.GetNativeOffset().ToString();
                string m = null;
                lock (callers2message)
                {
                    if (callers2message.TryGetValue(caller, out m) && m == message)
                        return -1;
                    callers2message[caller] = message;
                }
            }

            MessageForm mf = new MessageForm(title, icon, message, buttons, default_button, owner, button_autosize ?? ButtonAutosize);
            mf.ShowInTaskbar = ShowInTaskbar;
            int result = mf.ShowDialog();

            if (no_duplicate ?? NoDuplicate)
                lock (callers2message)
                {
                    callers2message.Remove(caller);
                }

            return result;
        }
Esempio n. 45
0
        private void btEquip_Click(object sender, EventArgs e)
        {
            Function.SoundManager.PlayButtonSound();
            if (!(theItem.ItemLevel >= 60 && selectedChar.UnitLevel < 60))
            {
                if ((selectedChar.UnitLevel + 4) >= theItem.ItemLevel)
                {
                    if (!CheckEpochalBattleCharms())
                    {
                        if (theItem.ItemType == EnumItemType.Battlecharm)
                        {
                            string oldname = theItem.ItemName;
                            while (BattleCharmNeedsNewName())
                            {
                                theItem.ItemName = Function.ItemGeneration.RandomizeNewName(theItem);
                            }
                            if (oldname != theItem.ItemName)
                            {
                                RPG.UI.MessageForm mes = new MessageForm("Because " + selectedChar.UnitName + " already had a Battlecharm with the name " + oldname + " the new battlecharm was renamed to " + theItem.ItemName + "!");
                                mes.ShowDialog();
                            }
                        }

                        var temp = this.player.InventoryOfPlayer.Find(x => x.Equals(theItem));
                        this.player.InventoryOfPlayer.Remove(temp);
                        if (toBeReplaced != null)
                            this.player.InventoryOfPlayer.Add(toBeReplaced);

                        switch (theItem.ItemType)
                        {
                            case EnumItemType.Weapon:
                                selectedChar.CharGear.AddOrRemoveWeapon((theItem as Core.Items.Weapon), true);
                                break;
                            case EnumItemType.Armor:
                                if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Chestarmor)
                                    selectedChar.CharGear.AddOrRemoveChestArmor((theItem as Core.Items.Armor), true);
                                else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Headarmor)
                                    selectedChar.CharGear.AddOrRemoveHeadArmor((theItem as Core.Items.Armor), true);
                                else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Legarmor)
                                    selectedChar.CharGear.AddOrRemoveLegArmor((theItem as Core.Items.Armor), true);
                                break;
                            case EnumItemType.Battlecharm:
                                try
                                {
                                    selectedChar.CharGear.AddOrRemoveBattleCharm((toBeReplaced as Core.Items.BattleCharm), false);
                                }
                                catch (Exception exp) { }
                                finally
                                {
                                    selectedChar.CharGear.AddOrRemoveBattleCharm((theItem as Core.Items.BattleCharm), true);
                                }
                                break;
                            default:
                                break;
                        }

                        RPG.UI.MessageForm messe = new MessageForm("Equipped " + theItem.ItemName + "!");
                        messe.ShowDialog();
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    }
                    else
                    {
                        RPG.UI.MessageForm mes = new MessageForm("You are not allowed to have two instances of the same Epochal Battlecharms equipped!");
                        mes.ShowDialog();
                    }
                }
                else
                {
                    RPG.UI.MessageForm mes = new MessageForm(selectedChar.UnitName + " is 5 or more levels lower than " + theItem.ItemName + "'s item level and is not allowed to equip it!");
                    mes.ShowDialog();
                }
            }
            else
            {
                RPG.UI.MessageForm mes = new MessageForm(selectedChar.UnitName + " must be level 60 to equip level 60+ items!");
                mes.ShowDialog();
            }
        }
Esempio n. 46
0
        public static void 载入出口报关单数据(ArchiveOperationForm masterForm)
        {
            GeneratedArchiveDataControlForm dataControlForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("出口_备案_报关单导入")) as GeneratedArchiveDataControlForm;

            if (dataControlForm.ShowDialog() == DialogResult.OK)
            {
                if (dataControlForm.DataControls["委托时间"].SelectedDataValue == null)
                {
                    ServiceProvider.GetService <IMessageBox>().ShowWarning("请输入委托时间!");
                    return;
                }

                if (DateTime.Parse(dataControlForm.DataControls["委托时间"].SelectedDataValue.ToString()) > DateTime.Today)
                {
                    ServiceProvider.GetService <IMessageBox>().ShowWarning("不能载入大于今天的报关单数据!");
                    return;
                }

                DateTime wtsj = DateTime.Parse(dataControlForm.DataControls["委托时间"].SelectedDataValue.ToString());

                int count = 0;
                ProgressAsyncHelper pah = new ProgressAsyncHelper(new Feng.Async.AsyncHelper.DoWork(
                                                                      delegate()
                {
                    foreach (KeyValuePair <string, string> id in Get_nbediRead_ID())
                    {
                        m_nbediRead = new nbediRead();
                        m_nbediRead.SetLoginInfo(id.Key, id.Value);

                        //List<string> bgdhList = m_nbediRead.查询报关单号(wtsj);
                        Dictionary <string, string> bgdhList = m_nbediRead.查询报关单号2(wtsj);

                        if (bgdhList == null || bgdhList.Count == 0)
                        {
                            continue;
                        }

                        // 查询数据库已有提单号,避免重复数据
                        using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <出口票>())
                        {
                            try
                            {
                                //IList<string> bgdh_List = (rep as Feng.NH.INHibernateRepository).Session.CreateCriteria(typeof(出口票))
                                //    .SetProjection(NHibernate.Criterion.Projections.Distinct(NHibernate.Criterion.Projections.ProjectionList()
                                //    .Add(NHibernate.Criterion.Projections.Property("报关单号")))).List<string>();

                                //bool is查验 = true; // 海关查验是否正常,异常将不查询查验结果

                                //foreach (string bgdh in bgdhList)   // 网上的报关单号
                                //{
                                foreach (KeyValuePair <string, string> bgdh in bgdhList)
                                {
                                    if (bgdh.Key.Substring(9, 1) == "0" || bgdh.Key.Substring(9, 1) == "1")        // 0 = 进口,5 = 出口
                                    {
                                        continue;
                                    }

                                    IList <出口票> ckp_List = (rep as Feng.NH.INHibernateRepository).Session.CreateCriteria(typeof(出口票))
                                                           .Add(NHibernate.Criterion.Expression.Eq("报关单号", bgdh.Key)).List <出口票>();

                                    if (ckp_List != null && ckp_List.Count > 0)
                                    {
                                        continue;
                                    }

                                    rep.BeginTransaction();

                                    报关单数据 bgdsj = m_nbediRead.查询报关单数据2(bgdh.Key, bgdh.Value);
                                    if (bgdsj != null)
                                    {
                                        出口票 ckp = new 出口票
                                        {
                                            报关单号 = bgdsj.报关单长号,
                                            抬头   = bgdsj.经营单位,
                                            提单号  = bgdsj.提运单号,
                                            核销单号 = bgdsj.批准文号,
                                            通关单号 = bgdsj.通关单号,
                                            //箱号 = bgdsj.箱号,// Formula = Distinct 出口箱.箱号
                                            箱量   = bgdsj.箱量,
                                            委托时间 = bgdsj.申报日期,
                                            船名航次 = bgdsj.船名航次,
                                            //报关单快照 = bgdsj.网页快照,
                                            报关员编号 = bgdsj.报关员,
                                            报关公司  = bgdsj.报关公司
                                        };

                                        if (!string.IsNullOrEmpty(ckp.提单号))
                                        {
                                            IList <集装箱数据> jzxList = null;
                                            try
                                            {
                                                jzxList = m_nbediRead.查询集装箱数据(bgdsj.提运单号.Trim(), bgdsj.船名航次.Split('/')[0], bgdsj.船名航次.Split('/')[1]);
                                                //IList<集装箱数据> jzxList = 查询出口集装箱数据By提单号航次(bgdsj.提运单号.Trim(), bgdsj.船名航次.Split('/')[1]);
                                            }
                                            catch
                                            {
                                            }

                                            if (jzxList != null && jzxList.Count > 0)
                                            {
                                                List <string> success箱号 = new List <string>();

                                                foreach (集装箱数据 jzx in jzxList)
                                                {
                                                    // 避免重复箱保存
                                                    bool isSame箱号 = false;
                                                    foreach (string 箱号 in success箱号)
                                                    {
                                                        if (jzx.集装箱号 == 箱号)
                                                        {
                                                            isSame箱号 = true;
                                                            break;
                                                        }
                                                    }

                                                    if (isSame箱号)
                                                    {
                                                        continue;
                                                    }

                                                    int xx = 0;
                                                    if (int.TryParse(jzx.箱型, out xx))
                                                    {
                                                        if (xx < 40)
                                                        {
                                                            xx = 20;
                                                        }

                                                        if (xx >= 45)
                                                        {
                                                            xx = 41;
                                                        }
                                                        else
                                                        {
                                                            xx = 40;
                                                        }
                                                    }

                                                    int?箱型编号 = null;
                                                    if (xx != 0)
                                                    {
                                                        箱型编号 = xx;
                                                    }

                                                    出口箱 newCkx = new 出口箱
                                                    {
                                                        箱号    = jzx.集装箱号,
                                                        箱型编号  = 箱型编号,
                                                        装货地编号 = (string)NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", jzx.堆场区),
                                                        进港时间  = jzx.Real进场时间,
                                                        //提箱时间 = jzx.Real提箱时间
                                                    };

                                                    //if (is查验)
                                                    //{
                                                    //    try
                                                    //    {
                                                    //        查询海关查验结果(newCkx);
                                                    //    }
                                                    //    catch (Exception ex)
                                                    //    {
                                                    //        is查验 = false;
                                                    //        MessageForm.ShowError(ex.Message, "海关查验");
                                                    //    }
                                                    //}

                                                    success箱号.Add(newCkx.箱号);

                                                    if (ckp.进港地编号 == null && ckp.离港时间 == null)
                                                    {
                                                        ckp.进港地编号 = newCkx.装货地编号;
                                                        //ckp.离港时间 = newCkx.进港时间;

                                                        new 出口票Dao().Save(rep, ckp);

                                                        保存报关单快照(bgdsj.报关单长号, bgdsj.网页快照);
                                                    }

                                                    newCkx.票 = ckp;
                                                    new HdBaseDao <出口箱>().Save(rep, newCkx);
                                                }
                                            }
                                            else
                                            {
                                                new 出口票Dao().Save(rep, ckp);
                                            }
                                        }
                                    }
                                    rep.CommitTransaction();
                                    count++;
                                }
                            }
                            catch (Exception ex)
                            {
                                rep.RollbackTransaction();
                                throw new NullReferenceException(ex.Message, ex);
                            }
                        }
                    }
                    return(null);
                }), new Feng.Async.AsyncHelper.WorkDone(
                                                                      delegate(object result)
                {
                    MessageForm.ShowInfo("成功载入报关单数据" + count + "条");
                }), masterForm, "载入报关单");
            }
        }
Esempio n. 47
0
      private void TriggerDefaultsButton_HoldTimeout(object sender, HoldTimeoutEventArgs e)
      {
         ParameterAccessor.Instance.TriggerDefaults();

         MessageForm messageForm = new MessageForm();
         messageForm.Title = "SYSTEM DEFAULTS";
         messageForm.Message = "DEFAULTS ASSIGNED ON THE NEXT SYSTEM START";

         this.SetDialogLocation(this.TriggerDefaultsButton, messageForm);

         this.DimBackground();
         messageForm.ShowDialog();
         this.LightBackground();
      }
Esempio n. 48
0
 public static void Show(IntPtr hwndParent, string strMessage, string strTitle, MessageBoxIcon icon, int msecDuration, bool fModal = false) {
     MessageForm form = new MessageForm(strMessage, strTitle, null, icon, msecDuration);
     if(hwndParent != IntPtr.Zero) {
         RECT rect;
         PInvoke.GetWindowRect(hwndParent, out rect);
         form.Location = new Point(rect.left + ((rect.Width - form.Width) / 2), rect.top + ((rect.Height - form.Height) / 2));
     }
     else {
         Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
         form.Location = new Point((workingArea.X + workingArea.Width) - form.Width, (workingArea.Y + workingArea.Height) - form.Height);
     }
     if(fModal) {
         form.TopMost = true;
         form.ShowDialog();
     }
     else {
         form.ShowMessageForm();
     }
 }
Esempio n. 49
0
		private void rosterView_DoubleClick(object sender, System.EventArgs e)
		{
			ContactTreeNode curContact = rosterView.SelectedNode as ContactTreeNode;
			if(curContact != null)
			{
				Contact c = curContact.Contact;

				if(!c.Online)
				{
					MessageBox.Show(this, "That person is not online.");
					return;
				}

				MessageForm msgf = null;
				// See if we already have a chat with this person
				foreach(string s in c.AllJabberId)
				{
					if(chats[s] != null)
					{
						msgf = (MessageForm)chats[s];
						msgf.Show();
						return;
					}
				}

				// If not, start a new chat with their first resource
				string jid = c.BaseJabberId+"/"+c.Resources[0];
				msgf = new MessageForm(session, "Title", jid, "en", newThreadId());
				msgf.Language = "en";
				msgf.ThreadId = newThreadId();
				chats[jid] = msgf;
				msgf.Show();
			}
		}
        private void            okCancelButton_ButtonClick(object aSender, EventArgs aEventArgs)
        {
            if (okCancelButton.DialogResult == DialogResult.Cancel)
            {
                DialogResult = DialogResult.Cancel;
            }
            else
            {
                try
                {
                    if (String.IsNullOrWhiteSpace(itemEditBox_Input.ItemName))
                    {
                        throw new ArgumentException("Input Item is missing. ");
                    }

                    if (String.IsNullOrWhiteSpace(itemEditBox_Output.ItemName))
                    {
                        throw new ArgumentException("Output Item is missing. ");
                    }

                    var lChecker = new RepeatItemNameChecker();
                    lChecker.addItemName(itemEditBox_Input.ItemName);
                    lChecker.addItemName(itemEditBox_Output.ItemName);

                    double lInMin;
                    double lInMax;
                    double lOutMin;
                    double lOutMax;

                    try
                    {
                        lInMin = StringUtils.toDouble(textBox_InMin.Text);
                    }
                    catch (Exception lExc)
                    {
                        throw new ArgumentException("Wrong minimum value for input signal. ", lExc);
                    }

                    try
                    {
                        lInMax = StringUtils.toDouble(textBox_InMax.Text);
                    }
                    catch (Exception lExc)
                    {
                        throw new ArgumentException("Wrong maximum value for input signal. ", lExc);
                    }

                    try
                    {
                        lOutMin = StringUtils.toDouble(textBox_OutMin.Text);
                    }
                    catch (Exception lExc)
                    {
                        throw new ArgumentException("Wrong minimum value for output signal. ", lExc);
                    }

                    try
                    {
                        lOutMax = StringUtils.toDouble(textBox_OutMax.Text);
                    }
                    catch (Exception lExc)
                    {
                        throw new ArgumentException("Wrong maximum value for output signal. ", lExc);
                    }

                    mScaleReal.mValueScale.setProperties(lInMax, lInMin, lOutMax, lOutMin);
                    mScaleReal.mInValueItemHandle  = mBrowser.getItemHandleByName(itemEditBox_Input.ItemName);
                    mScaleReal.mOutValueItemHandle = mBrowser.getItemHandleByName(itemEditBox_Output.ItemName);
                }
                catch (Exception lExc)
                {
                    MessageForm.showMessage(lExc.Message, this);
                    return;
                }

                DialogResult = DialogResult.OK;
            }
        }
Esempio n. 51
0
        static int show(string caption, Icon icon, out bool silent_box, string message, string[] answers, int default_answer)
        {
            try
            {
                if (ShowMessagesInTurn)
                {
                    if (caller_is_gui_form())
                    {
                        while (!System.Threading.Monitor.TryEnter(lock_variable))
                            show_blocking_dialog();
                        //while (!System.Threading.Monitor.TryEnter(lock_variable))
                        //    Application.DoEvents();
                    }
                    else
                        System.Threading.Monitor.Enter(lock_variable);
                }

                MessageForm mf = new MessageForm(caption, message, get_button_colors(), answers, default_answer, SilentBoxText, icon);
                preset(mf);
                int i = mf.GetAnswer();
                silent_box = mf.Silent;
                postset();
                return i;
            }
            finally
            {
                if (ShowMessagesInTurn)
                    System.Threading.Monitor.Exit(lock_variable);
            }
        }
Esempio n. 52
0
 /// <summary>
 /// This is incomplete attempt to (a) prevent duplicate data source error messages, and
 /// (b) indicate erroneous datasources in the data tree with an icon or something.
 /// TODO (or discard).
 /// </summary>
 /// <param name="msg"></param>
 public static void ReportDataSourceError(string msg)
 {
     MainForm.HideSpash();
     MessageForm.Error(msg);
 }
 private void deadletterDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     var bindingList = deadletterBindingSource.DataSource as BindingList<BrokeredMessage>;
     if (bindingList == null)
     {
         return;
     }
     using (var messageForm = new MessageForm(bindingList[e.RowIndex], serviceBusHelper, writeToLog))
     {
         messageForm.ShowDialog();
     }
 }
Esempio n. 54
0
        void m_MapSelectBarItem_EditValueChanged(object sender, EventArgs e)
        {
            if (m_SelfRefresh)
            {
                return;
            }

            var cea = new CancelEventArgs();

            OnMapChanging(cea);
            if (cea.Cancel)
            {
                m_MapSelectBarItem.EditValueChanged -= m_MapSelectBarItem_EditValueChanged;
                m_MapSelectBarItem.EditValue         = m_OldMapName;
                m_MapSelectBarItem.EditValueChanged += m_MapSelectBarItem_EditValueChanged;
                return;
            }

            if (m_MapControl != null && m_MapControl.Map != null && m_MapControl.Image != null)
            {
                var selectedValue = m_MapSelectBarItem.EditValue as String;

                string mapFileName;

                if (selectedValue == MapProjectsStorage.DefaultMapName)
                {
                    mapFileName = MapProjectsStorage.DefaultMapPath;
                }
                else
                {
                    mapFileName = MapProjectsStorage.GetMapFullPath(MapProjectsStorage.CustomProjectsPath, selectedValue);
                }


                var msg     = EidssMessages.GetForCurrentLang("gis_Message_OpenMap", "Would you like to open this map?");
                var caption = EidssMessages.GetForCurrentLang("gis_Caption_OpenMap", "Open map: ");
                var errMsg  = EidssMessages.GetForCurrentLang("gis_ErrMessage_OpenMap", "Can't open selected map.");

                if (MessageForm.Show(msg, caption + selectedValue, MessageBoxButtons.YesNo,
                                     MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var extent = m_MapControl.Map.Envelope.Clone();

                    try
                    {
                        //check AVR layers and store it for future use

                        if (m_MapControl.Parent is AvrMapControl)
                        {
                            //EventLayer eventLayer = null;
                            LayerGroup eventGroup = null;

                            //foreach (var layer in m_MapControl.Map.Layers)
                            //{
                            //    if (!(layer is EventLayer)) continue;
                            //    eventLayer = (EventLayer) layer;
                            //    break;
                            //}

                            foreach (LayerGroup layer in m_MapControl.Map.Layers.OfType <LayerGroup>())
                            {
                                eventGroup = layer;
                                if (eventGroup.Tag.ToString() != "eventgroup")
                                {
                                    continue;
                                }

                                eventGroup = layer;
                                break;
                            }
                            var pos = m_MapControl.Map.Layers.IndexOf(eventGroup);
                            (m_MapControl.Parent as EidssMapControl).LoadMap(mapFileName);
                            if (eventGroup != null)
                            {
                                m_MapControl.Map.Layers.Insert(pos, eventGroup);
                            }

                            ((AvrMapControl)(m_MapControl.Parent)).UseDynamicData();
                            Content.RefreshMapContent();
                        }
                        else
                        {
                            (m_MapControl.Parent as EidssMapControl).LoadMap(mapFileName);
                        }

                        m_OldMapName = selectedValue;
                    }
                    catch (Exception ex)
                    {
                        ErrorForm.ShowErrorDirect(errMsg, ex);
                        //return old value
                        m_SelfRefresh = true;
                        m_MapSelectBarItem.EditValue = m_OldMapName;
                        m_SelfRefresh = false;
                        return;
                    }

                    m_MapControl.Map.ZoomToBox(extent);

                    m_MapControl.Refresh();

                    //deactivate all edit tools
                    if ((m_MapControl.Parent as MapControl).DefaultTool is ControllerMapTool)
                    {
                        ((m_MapControl.Parent as MapControl).DefaultTool as ControllerMapTool).IsActive = true;
                    }
                }
                else
                {
                    //return old value
                    m_SelfRefresh = true;
                    m_MapSelectBarItem.EditValue = m_OldMapName;
                    m_SelfRefresh = false;
                }
            }
        }
Esempio n. 55
0
 public static void Show(string strMessage, string strTitle, string strExecute, MessageBoxIcon icon, int msecDuration) {
     MessageForm form = new MessageForm(strMessage, strTitle, strExecute, icon, msecDuration);
     Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
     form.Location = new Point((workingArea.X + workingArea.Width) - form.Width, (workingArea.Y + workingArea.Height) - form.Height);
     form.ShowMessageForm();
 }
Esempio n. 56
0
        /// <summary>
        /// 导入或修改车型参数
        /// </summary>
        /// <param name="importType"></param>
        protected void ImportMainData(string importType)
        {
            string operateType = string.Empty;

            if (importType == "IMPORT")
            {
                operateType = "导入";
            }
            else if (importType == "UPDATE")
            {
                operateType = "修改";
            }

            FuelDataSysClient.Tool.Tool_Mits.MitsUtils utils = new FuelDataSysClient.Tool.Tool_Mits.MitsUtils();
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.MainFileName);
                    if (fileNameList.Count > 0)
                    {
                        string        fileNameMsg    = string.Empty;
                        string        returnMsg      = string.Empty;
                        List <string> mainUpdateList = new List <string>();

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportMainData(fileName, folderPath, importType, mainUpdateList);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = operateType + "结果";
                        mf.ShowDialog();

                        if (importType == "IMPORT")
                        {
                            this.ShowMainData();
                        }
                        else if (importType == "UPDATE")
                        {
                            this.ShowUpdatedMainData(mainUpdateList);
                        }
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.MainFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(operateType + "失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 57
0
 private void CopyStot()
 {
     string clstr = "";
     StringBuilder sb = new StringBuilder();
     bool IsProtected = false;
     bool isDm = false;
     if (this._curTab != null && this._statuses.GetTabByName(this._curTab.Text) != null) isDm = this._statuses.GetTabByName(this._curTab.Text).TabType == MyCommon.TabUsageType.DirectMessage;
     foreach (int idx in _curList.SelectedIndices)
     {
         PostClass post = _statuses[_curTab.Text, idx];
         if (post.IsProtect)
         {
             IsProtected = true;
             continue;
         }
         if (post.IsDeleted) continue;
         if (!isDm)
         {
             if (post.RetweetedId > 0)
                 sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.ScreenName, post.TextFromApi, post.RetweetedId, Environment.NewLine);
             else
                 sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.ScreenName, post.TextFromApi, post.StatusId, Environment.NewLine);
         }
         else
         {
             sb.AppendFormat("{0}:{1} [{2}]{3}", post.ScreenName, post.TextFromApi, post.StatusId, Environment.NewLine);
         }
     }
     if (IsProtected)
     {
         //MessageBox.Show(Properties.Resources.CopyStotText1);
         using (MessageForm w = new MessageForm())
         {
             w.ShowDialog(Properties.Resources.CopyStotText1);
         }
     }
     if (sb.Length > 0)
     {
         clstr = sb.ToString();
         try
         {
             Clipboard.SetDataObject(clstr, false, 5, 100);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Esempio n. 58
0
        /// <summary>
        /// 导入VIN
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportVin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FuelDataSysClient.Tool.Tool_Mits.MitsUtils utils = new FuelDataSysClient.Tool.Tool_Mits.MitsUtils();
            this.gvCtny.PostEditor();
            int[] selectedHandle;
            selectedHandle = this.gvCtny.GetSelectedRows();
            if (selectedHandle.Count() > 0)
            {
                if (selectedHandle[0] < 0)
                {
                    MessageBox.Show("请选择数据");
                    return;
                }
            }
            else
            {
                MessageBox.Show("请选择数据");
                return;
            }
            FolderDialog openFolder = new FolderDialog();

            try
            {
                if (openFolder.DisplayDialog() == DialogResult.OK)
                {
                    // 获取用户选择的文件夹路径
                    string folderPath = openFolder.Path.ToString();

                    // 获取folderPath下以格式为utils.CocFileName的所有文件
                    List <string> fileNameList = utils.GetFileName(folderPath, utils.VinFileName);
                    if (fileNameList.Count > 0)
                    {
                        string fileNameMsg = string.Empty;
                        string returnMsg   = string.Empty;

                        // 获取全部主表数据,用作合并VIN数据
                        bool IsMainDataExist = utils.GetMainData();
                        if (!IsMainDataExist)
                        {
                            MessageBox.Show("系统中不存在车型数据,请首先导入车型数据", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // 遍历读所有文件fileNameList
                        foreach (string fileName in fileNameList)
                        {
                            // fileNameMsg += Path.GetFileName(fileName) + "\r\n";

                            // 导入filename文件信息
                            returnMsg += utils.ImportVinData(fileName, folderPath);
                        }

                        MessageForm mf = new MessageForm(returnMsg);
                        Utils.SetFormMid(mf);
                        mf.Text = "导入结果";
                        mf.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("目录" + folderPath + "下没有文件" + utils.VinFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导入失败:" + ex.Message);
            }
        }
Esempio n. 59
0
        public static List <FieldDefinition> ShowDialog(string caption, IEnumerable <FieldDefinition> fields, Func <IEnumerable <FieldDefinition>, string> validateFunc = null)
        {
            var values = new List <FieldDefinition>();

            var prompt = new MessageForm()
            {
                Width           = 500,
                Height          = 90 + (fields.Count() * 55),
                FormBorderStyle = FormBorderStyle.FixedDialog,
                Text            = caption,
                StartPosition   = FormStartPosition.CenterScreen
            };

            var top     = 10;
            var boxes   = new List <Control>();
            var counter = 1;

            foreach (var field in fields)
            {
                var label     = field.Label;
                var textLabel = new Label()
                {
                    Left = 40, Top = top, Text = label, AutoSize = true
                };
                top += 25;
                prompt.Controls.Add(textLabel);

                Control control;

                switch (field.FieldType)
                {
                case FieldType.Text:
                    var textBox = new MaskedTextBox()
                    {
                        Left = 40, Top = top, Width = 400
                    };

                    if (label.Contains("Ip-address"))
                    {
                        //textBox.Mask = "990.990.990.990";
                        //textBox.ValidatingType = typeof(System.Net.IPAddress);
                        textBox.Culture = CultureInfo.InvariantCulture;
                    }
                    else if (label.Contains("MAC-address"))
                    {
                        textBox.Mask    = "AA-AA-AA-AA-AA-AA";
                        textBox.Culture = CultureInfo.InvariantCulture;
                    }

                    control = textBox;
                    break;

                case FieldType.Shortcut:
                    var shortcutTextBox = new TextBox()
                    {
                        Left     = 40,
                        Top      = top,
                        Width    = 200,
                        Name     = $"edtShortcut_{counter}",
                        ReadOnly = true
                    };

                    shortcutTextBox.KeyDown += prompt.edtShortcut_KeyDown;
                    shortcutTextBox.KeyUp   += prompt.edtShortcut_KeyUp;

                    if (field.Value != null)
                    {
                        shortcutTextBox.Text = field.Value.ToString();
                    }

                    control = shortcutTextBox;
                    break;

                case FieldType.Numeric:
                    var numericEdit = new NumericUpDown()
                    {
                        Left = 40, Top = top, Width = 400
                    };

                    if (field.MinValue != field.MaxValue)
                    {
                        numericEdit.Minimum = field.MinValue;
                        numericEdit.Maximum = field.MaxValue;
                    }

                    if (field.Value != null)
                    {
                        numericEdit.Text = field.Value.ToString();
                    }

                    control = numericEdit;
                    break;

                case FieldType.DropDown:
                    var comboBox = new ComboBox
                    {
                        Left          = 40,
                        Top           = top,
                        Width         = 400,
                        DropDownStyle = ComboBoxStyle.DropDownList
                    };

                    if (field.Values != null && field.Values.Any())
                    {
                        comboBox.Items.AddRange(field.Values.ToArray());
                        comboBox.SelectedIndex = 0;
                    }

                    control = comboBox;
                    break;

                case FieldType.Flags:
                    var checkedListBox = new CheckedListBox
                    {
                        Left   = 40,
                        Top    = top,
                        Width  = 200,
                        Height = 100
                    };

                    top           += 80;
                    prompt.Height += 80;

                    if (field.Values != null && field.Values.Any())
                    {
                        var compoundValue = (int)field.Value;
                        var enumValue     = 1;
                        foreach (var value in field.Values)
                        {
                            var isChecked = (compoundValue & enumValue) == enumValue;

                            checkedListBox.Items.Add(value, isChecked);

                            enumValue *= 2;
                        }
                    }

                    control = checkedListBox;
                    break;

                default:
                    continue;
                }

                top += 30;
                prompt.Controls.Add(control);
                boxes.Add(control);
                control.Tag = field;
                counter++;
            }

            var confirmation = new Button()
            {
                Text = "OK", Left = 365, Width = 75, Top = prompt.ClientRectangle.Height - 30
            };

            confirmation.Click += (sender, e) =>
            {
                foreach (var box in boxes)
                {
                    var field = (FieldDefinition)box.Tag;

                    switch (field.FieldType)
                    {
                    case FieldType.Flags:
                        var checkedListBox = (CheckedListBox)box;

                        var compoundValue = 0;
                        var enumValue     = 1;
                        for (var i = 0; i < checkedListBox.Items.Count; i++)
                        {
                            compoundValue += checkedListBox.GetItemChecked(i) ? enumValue : 0;
                            enumValue     *= 2;
                        }

                        field.Value = compoundValue;
                        break;

                    default:
                        field.Value = box.Text.Trim();
                        break;
                    }
                }


                if (validateFunc != null)
                {
                    var message = validateFunc(fields);

                    if (!string.IsNullOrEmpty(message))
                    {
                        WarningOk(message);
                        return;
                    }
                }

                values.AddRange(fields);

                prompt.Close();
            };
            prompt.Controls.Add(confirmation);
            prompt.AcceptButton = confirmation;

            prompt.ShowDialog(MainForm);

            return(values);
        }
Esempio n. 60
0
        public static void 生成收款相应费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.MasterGrid.GridControl.SelectedRows.Count == 0)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("请选择付款费用!");
                return;
            }
            if (!MessageForm.ShowYesNo("是否要生成选中项相应的收款费用?", "确认"))
            {
                return;
            }

            int cnt = 0;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
            {
                foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                {
                    Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                    if (dataRow == null)
                    {
                        continue;
                    }

                    业务费用 entity = dataRow.Tag as 业务费用;
                    if (entity.收付标志 == 收付标志.收)
                    {
                        continue;
                    }

                    rep.Initialize(entity.票, entity);

                    业务费用 item = new 业务费用();
                    item.收付标志  = 收付标志.收;
                    item.费用实体  = entity.费用实体;
                    item.费用项编号 = entity.费用项编号;
                    //item.费用信息 = entity.费用信息;
                    item.费用类别编号 = entity.费用类别编号;
                    item.金额     = entity.金额;
                    item.箱Id    = entity.箱Id;
                    item.相关人编号  = entity.票.委托人编号;
                    item.票      = entity.票;
                    item.箱      = entity.箱;

                    object newEntity = masterForm.ControlManager.AddNew();
                    if (newEntity != null)
                    {
                        masterForm.ControlManager.DisplayManager.Items[masterForm.ControlManager.DisplayManager.Position] = item;
                        masterForm.ControlManager.EndEdit();
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = dataRow.Cells["费用项编号"].CellEditorManager;
                        cnt++;
                    }
                    else
                    {
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }
            MessageForm.ShowInfo("已生成" + cnt + "条收款费用!");
        }