示例#1
0
        private void postDGV_FirstReload()
        {
            postDGV.Rows.Clear();
            serveList = Serve.Get();
            postList  = Post.Get();
            comboBoxServe.Items.Clear();
            foreach (Post post in postList)
            {
                foreach (Serve serve in serveList)
                {
                    if (GetPostServe(post, serve) != "0")
                    {
                        postDGV.Rows.Add(post.idpost, post.title, post.salary, serve.name);
                    }
                }
            }

            for (int i = 0; i < postDGV.RowCount; ++i)
            {
                postDGV.Rows[i].Selected = false;
            }
            foreach (Serve serve in serveList)
            {
                comboBoxServe.Items.Add(serve.name);
            }
            comboBoxServe.SelectedIndex = -1;

            textBoxPost.Text   = "";
            textBoxSalary.Text = "";
            comboBoxServe.Text = null;

            choosenIndexPost = -1;
        }
示例#2
0
 private bool GetCafeServ(Cafe cafe)
 {
     serveList = Serve.Get();
     postList  = Post.Get();
     foreach (Serve serve in serveList)
     {
         if (cafe.idcafe == serve.cafe.idcafe)//смотрим есть ли в этом кафе сотрудники
         {
             foreach (Post post in postList)
             {
                 if (serve.idserve == post.serve.idserve)//смотрим есть ли должность у сотрудника
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
示例#3
0
        private Post postGetFromForm()
        {
            int  i       = 0;
            Post newPost = new Post();

            if (string.IsNullOrWhiteSpace(textBoxPost.Text) || string.IsNullOrEmpty(textBoxPost.Text))
            {
                ErrorlabelPost.Text = "Ошибка:\r\nПоле \"Должность\" должно быть обязательно заполнено.";
                throw new System.ArgumentNullException();
            }
            else
            {
                newPost.title = textBoxPost.Text;
            }
            if (string.IsNullOrWhiteSpace(textBoxSalary.Text) || string.IsNullOrEmpty(textBoxSalary.Text))
            {
                ErrorlabelPost.Text = "Ошибка:\r\nПоле \"Зарплата\" должно быть обязательно заполнено.";
                throw new System.ArgumentNullException();
            }
            else
            {
                newPost.salary = Convert.ToInt32(textBoxSalary.Text);
            }
            if (string.IsNullOrWhiteSpace(comboBoxServe.Text) || string.IsNullOrEmpty(comboBoxServe.Text))
            {
                ErrorlabelPost.Text = "Ошибка:\r\nПоле \"Сотрудник\" должно быть обязательно заполнено.";
                throw new System.ArgumentNullException();
            }
            else
            {
                while (comboBoxServe.Text != serveList[i].name)
                {
                    ++i;
                }
                newPost.serve = Serve.Get(serveList[i].idserve);
            }
            return(newPost);
        }
示例#4
0
        private void servDGV_FirstReload()
        {
            servDGV.Rows.Clear();
            cafeList  = Cafe.Get();
            serveList = Serve.Get();

            comboBoxServeCafe.Items.Clear();
            foreach (Serve serve in serveList)
            {
                foreach (Cafe cafe in cafeList)
                {
                    if (GetCafeServe(cafe, serve) != "0")
                    {
                        servDGV.Rows.Add(serve.idserve, serve.name, serve.passport, serve.education, serve.experience, cafe.address);
                    }
                }
            }

            for (int i = 0; i < servDGV.RowCount; ++i)
            {
                servDGV.Rows[i].Selected = false;
            }
            foreach (Cafe cafe in cafeList)
            {
                comboBoxServeCafe.Items.Add(cafe.address);
            }
            comboBoxServeCafe.SelectedIndex = -1;

            textBoxName.Text       = "";
            textBoxPassport.Text   = "";
            textBoxEducation.Text  = "";
            textBoxExperience.Text = "";
            comboBoxServeCafe.Text = null;

            choosenIndexServe = -1;
        }