示例#1
0
        private void modifyJobToolStripMenuItem_Click(object sender, EventArgs e)
        {
            JobInfo jobInfo = this.TheSqlData.ReaderJobInfo(this.iJobID);

            if (jobInfo != null)
            {
                int    num            = this.iJobID;
                string the_strJobName = jobInfo.strJobName;
                string text           = jobInfo.strNote;
                Form14 form           = new Form14();
                form.bModify        = true;
                form.The_iJobID     = num;
                form.The_strJobName = the_strJobName;
                form.The_strNote    = text;
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    the_strJobName = form.The_strJobName;
                    text           = form.The_strNote;
                    if (this.TheSqlData.UpdateJobInfo(num, the_strJobName, text))
                    {
                        this.Jobs = this.TheSqlData.ReaderJobs();
                        this.ShowJobsForListView(this.listView1, this.Jobs);
                        this.SetListViewItemSelectFocus(this.listView1, this.iItem);
                    }
                    else
                    {
                        MessageBox.Show(string.Concat(new string[]
                        {
                            Properties.Resources.Update,
                            " ",
                            Properties.Resources.JobInfo,
                            " ",
                            Properties.Resources.Failure,
                            "!"
                        }));
                    }
                }
            }
        }
示例#2
0
        private void newJobToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool flag          = false;
            bool flag2         = true;
            int  maxValueJobID = this.TheSqlData.GetMaxValueJobID();

            if (maxValueJobID != -1)
            {
                int    num   = maxValueJobID + 1;
                string text  = "";
                string text2 = "";
                while (!flag && flag2)
                {
                    Form14 form = new Form14();
                    form.bModify        = false;
                    form.The_iJobID     = num;
                    form.The_strJobName = text;
                    form.The_strNote    = text2;
                    if (form.ShowDialog(this) == DialogResult.OK)
                    {
                        num   = form.The_iJobID;
                        text  = form.The_strJobName;
                        text2 = form.The_strNote;
                        if (!this.TheSqlData.IsExistJobID(num))
                        {
                            if (this.TheSqlData.InsertJobInfo(num, text, text2))
                            {
                                this.Jobs = this.TheSqlData.ReaderJobs();
                                this.ShowJobsForListView(this.listView1, this.Jobs);
                                this.SetListViewItemSelectFocus(this.listView1, this.listView1.Items.Count - 1);
                                flag = true;
                            }
                            else
                            {
                                MessageBox.Show(string.Concat(new string[]
                                {
                                    Properties.Resources.Insert,
                                    Properties.Resources.JobInfo,
                                    " ",
                                    Properties.Resources.Failure,
                                    "!"
                                }));
                            }
                        }
                        else
                        {
                            MyMsgBox.MsgError(string.Concat(new string[]
                            {
                                Properties.Resources.InfoOfJob,
                                ": ",
                                num.ToString(),
                                ". ",
                                text,
                                " ",
                                Properties.Resources.IsExisted,
                                "!"
                            }));
                        }
                    }
                    else
                    {
                        flag2 = false;
                    }
                }
            }
        }