private void ResetAppointPoint()
        {
            Appoint appoint = null;

            if (dgvQueue.SelectedRows.Count > 0)
            {
                BindingList <AppointState> appoints = (BindingList <AppointState>)dgvQueue.DataSource;
                appoint = appoints[dgvQueue.SelectedRows[0].Index].Appoint;
            }
            else
            {
                if (dgvLoading.SelectedRows.Count > 0)
                {
                    BindingList <AppointState> appoints = (BindingList <AppointState>)dgvLoading.DataSource;
                    appoint = appoints[dgvLoading.SelectedRows[0].Index].Appoint;
                }
                else
                {
                    MessageBox.Show(resources.Message.NoAppointSelected, "Ошибка");
                    return;
                }
            }

            FormStart      form        = (FormStart)MdiParent;
            FormSetToPoint formAppoint = new FormSetToPoint();

            formAppoint.Database  = database;
            formAppoint.Appoint   = appoint;
            formAppoint.SaveData += eventRefreshData;
            form.AddChild(formAppoint);
        }
Beispiel #2
0
        public MaterialPermit(Appoint appoint)
        {
            id           = 0;
            this.unit    = appoint.Unit;
            docNumber    = "";
            docDate      = DateTime.Today;
            person       = appoint.DriverName;
            vehicleMark  = appoint.TrackMark;
            licensePlate = appoint.LicensePlate;

            createFlag = 0;
            creator    = null;
            createDate = DateTime.MinValue;

            signedFlag = 0;
            signer     = null;
            signDate   = DateTime.MinValue;

            entryFlag  = 0;
            entryPoint = null;
            entryDate  = DateTime.MinValue;

            comment = "";

            PermitId = appoint.PermitId;

            baseDocument  = "доверенность";
            baseDocNumber = appoint.Warrant;
            baseDocDate   = DateTime.Today;

            IsNew = false;
            Insert();
        }
            public static List <Appoint> SetAppoint(string ID)
            {
                List <Appoint> meets = new List <Appoint>();

                //using (SqlConnection connection = new SqlConnection("Data Source=(localdb)\\ProjectsV13;Integrated Security=True;Database = master"))
                using (SqlConnection connection = new SqlConnection(@"Data Source=NETRA\SQLEXPRESS;Integrated Security=True;Database = master; uid=NETRA\Dell"))
                {
                    connection.Open();
                    string     StrQuery = $"select ID, timing from appointments where ID = '{ID}' and map = 'F' ";
                    SqlCommand command  = new SqlCommand(StrQuery, connection);
                    //SqlCommand command1 = new SqlCommand(StrQuery2, connection1);
                    command.CommandType = CommandType.Text;
                    //command1.CommandType = CommandType.Text;
                    DataTable      university = new DataTable();
                    SqlDataAdapter adapter    = new SqlDataAdapter(command);
                    adapter.Fill(university);
                    foreach (DataRow dr in university.Rows)
                    {
                        string id    = dr["ID"].ToString();
                        string times = dr["timing"].ToString();
                        //string maps = dr["map"].ToString();
                        //string day = dr["day"].ToString();
                        Appoint t = new Appoint();
                        t.ID   = id;
                        t.Time = times;
                        //t.Map = map;
                        //t.Day = day;
                        meets.Add(t);
                    }
                }

                return(meets);
            }
        public async Task <IActionResult> AppEdit(Appoint app)
        {
            //Appoint app = db.Appoints.Find(id);
            //db.Entry(app).State = EntityState.Modified;
            db.Update(app);
            await db.SaveChangesAsync();

            return(RedirectToAction("Appoint"));
        }
        private void SetAppointOut()
        {
            Appoint appoint = (Appoint)bsAppoints.Current;

            if (appoint != null)
            {
                appoint.GetOut(database);
            }
            RefreshData();
        }
 public IActionResult AppAdd(Appoint app)
 {
     if (ModelState.IsValid)
     {
         //ViewBag.Message = "Валидация пройдена";
         db.Appoints.Add(app);
         db.SaveChanges();
         return(RedirectToAction("Appoint"));
     }
     //ViewBag.Message = "Запрос не прошел валидацию";
     return(View(app));
 }
        public IActionResult AppDel(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Appoint"));
            }
            Appoint app = db.Appoints.Find(id);

            db.Appoints.Remove(app);
            db.SaveChanges();
            return(Redirect("Appoint"));
        }
        public async Task <IActionResult> AppointEdit(int?id)
        {
            if (id != null)
            {
                Appoint app = await db.Appoints.FirstOrDefaultAsync(p => p.Id == id);

                if (app != null)
                {
                    return(View(app));
                }
            }
            return(NotFound());
        }
Beispiel #9
0
        public void OnAppointment(Employee employee)
        {
            if (employee is Manager)
            {
                // appoint manager
                manager = employee as Manager;
                Appoint?.Invoke(this, employee);
            }
            else

            {
                worker = employee;
                Appoint?.Invoke(this, employee);
            }
        }
        private void FinishAppointLoading()
        {
            BindingList <AppointState> appoints = (BindingList <AppointState>)dgvLoading.DataSource;

            if (dgvLoading.SelectedRows.Count > 0)
            {
                Appoint appoint = appoints[dgvLoading.SelectedRows[0].Index].Appoint;
                if (MessageBox.Show(resources.Message.AskLoadingFinish, appoint.LicensePlate, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    appoint.EndPoint(database, User);
                    RefreshData();
                }
            }
            else
            {
                MessageBox.Show(resources.Message.WrongDataGridView, "Ошибка");
            }
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            Write("請輸入1~100數值:");
            int num = int.Parse(ReadLine());

            if (num > 100 || num < 1)
            {
                WriteLine("數值不對");
            }
            else
            {
                //2.Lambda運算式取代委派方法;3.宣告委派物件deputation
                Appoint deputation = number => number * number;
                //4.呼叫委派
                WriteLine($"運算結果:{deputation(num):n0}");
            }
            ReadKey();
        }
Beispiel #12
0
        public void OnAppointment(Employee employee)
        {
            if (employee != null)
            {
                switch (employee)
                {
                case Employee empl when empl is Employee:
                    worker = new Employee(employee);
                    break;

                case Employee empl when empl is Manager:
                    manager = new Manager((Manager)employee);
                    break;

                default:
                    break;
                }

                Appoint.Invoke(this, employee);
            }
        }