Ejemplo n.º 1
0
 private void Form13_Load(object sender, EventArgs e)
 {
     this.LoadCaptionForControls();
     this.InitColumnsHeaderForListView(this.listView1);
     this.Jobs = this.TheSqlData.ReaderJobs();
     this.ShowJobsForListView(this.listView1, this.Jobs);
 }
Ejemplo n.º 2
0
 private void ShowJobsForListView(ListView lv, JobArray Js)
 {
     lv.Items.Clear();
     if (Js != null)
     {
         for (int i = 0; i < Js.Count; i++)
         {
             JobInfo      jobInfo      = Js[i];
             ListViewItem listViewItem = new ListViewItem(new string[]
             {
                 jobInfo.iJobID.ToString(),
                 jobInfo.strJobName,
                 jobInfo.strNote
             }, 0);
             listViewItem.Tag = jobInfo.iJobID.ToString("0000");
             lv.Items.Add(listViewItem);
         }
         this.toolStripStatusLabel1.Text = string.Concat(new string[]
         {
             Properties.Resources.Total,
             ": ",
             Js.Count.ToString(),
             " ",
             Properties.Resources.Job_s_,
             "."
         });
     }
 }
Ejemplo n.º 3
0
        private void deleteJobToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int          num          = this.iJobID;
            string       text         = this.strJobName;
            DialogResult dialogResult = MessageBox.Show(string.Concat(new string[]
            {
                Properties.Resources.DoYouWantTo,
                " ",
                Properties.Resources.Delete,
                " ",
                Properties.Resources.JobInfo,
                ": ",
                this.iJobID.ToString(),
                ". ",
                this.strJobName,
                "?"
            }), Properties.Resources.DeleteJob, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.OK)
            {
                if (this.TheSqlData.DeleteJobInfo(this.iJobID))
                {
                    this.Jobs = this.TheSqlData.ReaderJobs();
                    this.ShowJobsForListView(this.listView1, this.Jobs);
                    this.SetListViewItemSelectFocus(this.listView1, (this.listView1.Items.Count > this.iItem) ? this.iItem : (this.iItem - 1));
                }
                else
                {
                    MessageBox.Show(string.Concat(new string[]
                    {
                        Properties.Resources.DeleteU,
                        " ",
                        Properties.Resources.JobInfo,
                        " ",
                        Properties.Resources.Failure,
                        "!"
                    }));
                }
            }
        }
Ejemplo n.º 4
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,
                            "!"
                        }));
                    }
                }
            }
        }
Ejemplo n.º 5
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;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void modifyEmployeeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EmployeeInfo employeeInfo = this.TheSqlData.ReaderEmployeeInfo(this.iEmployeeID);

            if (employeeInfo != null)
            {
                int             num             = this.iEmployeeID;
                string          text            = employeeInfo.strFirstName;
                string          text2           = employeeInfo.strLastName;
                bool            flag            = employeeInfo.bMenOrWomen;
                DateTime        dateTime        = employeeInfo.dtBirthDate;
                string          text3           = employeeInfo.strTitle;
                DepartmentArray departmentArray = this.TheSqlData.ReaderDepartments();
                if (departmentArray.Count != 0)
                {
                    string[] array = new string[departmentArray.Count];
                    for (int i = 0; i < departmentArray.Count; i++)
                    {
                        array[i] = departmentArray[i].strDepartmentName;
                    }
                    int[] array2 = new int[departmentArray.Count];
                    for (int i = 0; i < departmentArray.Count; i++)
                    {
                        array2[i] = departmentArray[i].iDepartmentID;
                    }
                    JobArray jobArray = this.TheSqlData.ReaderJobs();
                    if (jobArray.Count != 0)
                    {
                        string[] array3 = new string[jobArray.Count];
                        for (int i = 0; i < jobArray.Count; i++)
                        {
                            array3[i] = jobArray[i].strJobName;
                        }
                        int[] array4 = new int[jobArray.Count];
                        for (int i = 0; i < jobArray.Count; i++)
                        {
                            array4[i] = jobArray[i].iJobID;
                        }
                        int      num2 = employeeInfo.iDepartmentID;
                        string   strDepartmentName = employeeInfo.strDepartmentName;
                        int      num3       = employeeInfo.iDepartmentID;
                        string   strJobName = employeeInfo.strJobName;
                        DateTime dateTime2  = employeeInfo.dtHireDate;
                        string   text4      = employeeInfo.strAddress;
                        string   text5      = employeeInfo.strCity;
                        string   text6      = employeeInfo.strPhone;
                        string   text7      = employeeInfo.strNote;
                        Form9    form       = new Form9();
                        form.bModify               = true;
                        form.The_DepartmentNames   = array;
                        form.The_DepartmentIDs     = array2;
                        form.The_JobNames          = array3;
                        form.The_JobIDs            = array4;
                        form.The_iEmployeeID       = num;
                        form.The_strFirstName      = text;
                        form.The_strLastName       = text2;
                        form.The_bMenOrWomen       = flag;
                        form.The_dtBirthDate       = dateTime;
                        form.The_strTitle          = text3;
                        form.The_iDepartmentID     = num2;
                        form.The_strDepartmentName = strDepartmentName;
                        form.The_iJobID            = num3;
                        form.The_strJobName        = strJobName;
                        form.The_dtHireDate        = dateTime2;
                        form.The_strAddress        = text4;
                        form.The_strCity           = text5;
                        form.The_strPhone          = text6;
                        form.The_strNote           = text7;
                        if (form.ShowDialog(this) == DialogResult.OK)
                        {
                            text      = form.The_strFirstName;
                            text2     = form.The_strLastName;
                            flag      = form.The_bMenOrWomen;
                            dateTime  = form.The_dtBirthDate;
                            text3     = form.The_strTitle;
                            num2      = form.The_iDepartmentID;
                            num3      = form.The_iJobID;
                            dateTime2 = form.The_dtHireDate;
                            text4     = form.The_strAddress;
                            text5     = form.The_strCity;
                            text6     = form.The_strPhone;
                            text7     = form.The_strNote;
                            if (this.TheSqlData.UpdateEmployeeInfo(num, text, text2, flag, dateTime, text3, num2, num3, dateTime2, text4, text5, text6, text7))
                            {
                                this.Employees = this.TheSqlData.ReaderEmployees();
                                this.ShowEmployeesForListView(this.listView1, this.Employees);
                                this.SetListViewItemSelectFocus(this.listView1, this.iItem);
                            }
                            else
                            {
                                MessageBox.Show(string.Concat(new string[]
                                {
                                    Properties.Resources.Update,
                                    " ",
                                    Properties.Resources.EmployeeInfo,
                                    " ",
                                    Properties.Resources.Failure,
                                    "!"
                                }));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void newEmployeeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool flag  = false;
            bool flag2 = true;
            int  maxValueEmployeeID = this.TheSqlData.GetMaxValueEmployeeID();

            if (maxValueEmployeeID != -1)
            {
                int             num             = maxValueEmployeeID + 1;
                string          text            = "";
                string          text2           = "";
                bool            flag3           = false;
                DateTime        the_dtBirthDate = new DateTime(1900, 1, 1);
                string          text3           = "";
                DepartmentArray departmentArray = this.TheSqlData.ReaderDepartments();
                if (departmentArray.Count != 0)
                {
                    string[] array = new string[departmentArray.Count];
                    for (int i = 0; i < departmentArray.Count; i++)
                    {
                        array[i] = departmentArray[i].strDepartmentName;
                    }
                    int[] array2 = new int[departmentArray.Count];
                    for (int i = 0; i < departmentArray.Count; i++)
                    {
                        array2[i] = departmentArray[i].iDepartmentID;
                    }
                    JobArray jobArray = this.TheSqlData.ReaderJobs();
                    if (jobArray.Count != 0)
                    {
                        string[] array3 = new string[jobArray.Count];
                        for (int i = 0; i < jobArray.Count; i++)
                        {
                            array3[i] = jobArray[i].strJobName;
                        }
                        int[] array4 = new int[jobArray.Count];
                        for (int i = 0; i < jobArray.Count; i++)
                        {
                            array4[i] = jobArray[i].iJobID;
                        }
                        int      num2 = 0;
                        string   the_strDepartmentName = "";
                        int      num3           = 0;
                        string   the_strJobName = "";
                        DateTime the_dtHireDate = new DateTime(1900, 1, 1);
                        string   text4          = "";
                        string   text5          = "";
                        string   text6          = "";
                        string   text7          = "";
                        while (!flag && flag2)
                        {
                            Form9 form = new Form9();
                            form.bModify               = false;
                            form.The_DepartmentNames   = array;
                            form.The_DepartmentIDs     = array2;
                            form.The_JobNames          = array3;
                            form.The_JobIDs            = array4;
                            form.The_iEmployeeID       = num;
                            form.The_strFirstName      = text;
                            form.The_strLastName       = text2;
                            form.The_bMenOrWomen       = flag3;
                            form.The_dtBirthDate       = the_dtBirthDate;
                            form.The_strTitle          = text3;
                            form.The_iDepartmentID     = num2;
                            form.The_strDepartmentName = the_strDepartmentName;
                            form.The_iJobID            = num3;
                            form.The_strJobName        = the_strJobName;
                            form.The_dtHireDate        = the_dtHireDate;
                            form.The_strAddress        = text4;
                            form.The_strCity           = text5;
                            form.The_strPhone          = text6;
                            form.The_strNote           = text7;
                            if (form.ShowDialog(this) == DialogResult.OK)
                            {
                                num                   = form.The_iEmployeeID;
                                text                  = form.The_strFirstName;
                                text2                 = form.The_strLastName;
                                flag3                 = form.The_bMenOrWomen;
                                the_dtBirthDate       = form.The_dtBirthDate;
                                text3                 = form.The_strTitle;
                                num2                  = form.The_iDepartmentID;
                                the_strDepartmentName = form.The_strDepartmentName;
                                the_strJobName        = form.The_strJobName;
                                num3                  = form.The_iJobID;
                                the_dtHireDate        = form.The_dtHireDate;
                                text4                 = form.The_strAddress;
                                text5                 = form.The_strCity;
                                text6                 = form.The_strPhone;
                                text7                 = form.The_strNote;
                                if (!this.TheSqlData.IsExistEmployeeID(num))
                                {
                                    if (this.TheSqlData.InsertEmployeeInfo(num, text, text2, flag3, the_dtBirthDate, text3, num2, num3, the_dtHireDate, text4, text5, text6, text7))
                                    {
                                        this.Employees = this.TheSqlData.ReaderEmployees();
                                        this.ShowEmployeesForListView(this.listView1, this.Employees);
                                        this.SetListViewItemSelectFocus(this.listView1, this.listView1.Items.Count - 1);
                                        flag = true;
                                    }
                                    else
                                    {
                                        MessageBox.Show(string.Concat(new string[]
                                        {
                                            Properties.Resources.Insert,
                                            Properties.Resources.EmployeeInfo,
                                            " ",
                                            Properties.Resources.Failure,
                                            "!"
                                        }));
                                    }
                                }
                                else
                                {
                                    MyMsgBox.MsgError(string.Concat(new string[]
                                    {
                                        Properties.Resources.InfoOfEmployee,
                                        ": ",
                                        num.ToString(),
                                        ". ",
                                        text,
                                        " ",
                                        text2,
                                        " ",
                                        Properties.Resources.IsExisted,
                                        "!"
                                    }));
                                }
                            }
                            else
                            {
                                flag2 = false;
                            }
                        }
                    }
                }
            }
        }