예제 #1
0
        private void DoctorBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Day.Visible = true;
            DayBox.Items.Clear();
            DayBox.Visible = true;
            List <DateTime> datecollection = new List <DateTime>();

            freetimecollection = freetime.List("Personal_Id", usercollection[DoctorBox.SelectedIndex].Id.ToString());
            foreach (FreeTimeModel F in freetimecollection)
            {
                datecollection.Add(F.Day);
            }
            IEnumerable <DateTime> dateday = datecollection.Distinct();

            foreach (DateTime D in dateday)
            {
                DayBox.Items.Add(D);
            }
        }
        public DoctorNewProc(DoctorStartWork F, long Client_Id, long Doctor_Id, long Proc_Id)
        {
            InitializeComponent();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //this.WindowState = FormWindowState.Maximized;
            back           = F;
            this.Client_Id = Client_Id;
            this.Doctor_Id = Doctor_Id;
            this.Proc_Id   = Proc_Id;
            List <DateTime> datecollection = new List <DateTime>();

            freetimecollection = freetime.List("Personal_Id", Doctor_Id.ToString());
            foreach (FreeTimeModel free in freetimecollection)
            {
                datecollection.Add(free.Day);
            }
            IEnumerable <DateTime> dateday = datecollection.Distinct();

            foreach (DateTime D in dateday)
            {
                DayBox.Items.Add(D);
            }
        }
예제 #3
0
        private void DeleteUser_Click_1(object sender, EventArgs e)
        {
            try
            {
                int selected = ListView.SelectedIndices[0];


                DialogResult result = MessageBox.Show("Вы действительно хотите удалить записи?", "Вы уверены?", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                // MessageBox.Show(this.DialogResult.ToString());
                if (result == DialogResult.Yes)
                {
                    // MessageBox.Show(selected.ToString());
                    // MessageBox.Show(ListView.Items[selected].SubItems[5].Text.ToString());
                    // MessageBox.Show(user.Get_Item("Login", ListView.Items[selected].SubItems[5].Text.ToString(), ConditionType.Equal).Id.ToString());
                    List <FreeTimeModel> freetimecollection = freetime.List("Personal_Id", user.Get_Item("Login", ListView.Items[selected].SubItems[5].Text.ToString(), ConditionType.Equal).Id.ToString());
                    foreach (FreeTimeModel M in freetimecollection)
                    {
                        freetime.Delete(M.Id);
                    }

                    UserModel changemodel = new UserModel();
                    changemodel = user.Get_Item("Login", ListView.Items[selected].SubItems[5].Text.ToString(), ConditionType.Equal);


                    if (changemodel.Login != "Admin")
                    {
                        changemodel.Login    = "";
                        changemodel.Password = "";
                    }
                    else
                    {
                        MessageBox.Show("Ключевая запись. Удаление невозможно");
                    }
                    user.Edit(changemodel);
                }
            }
            catch
            {
                MessageBox.Show("Ничего не выбрано");
            }

            this.Refresh_list();
        }