Esempio n. 1
0
        public async Task <IActionResult> Index(PassPort passport)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.message = "Неверные Паспортные Данные";
                return(View());
            }
            PassPort fullPassportVal = new PassPort();

            fullPassportVal.fullPassport = fullPassport.fullPassport(passport.passSeries, passport.passNumber);
            ViewBag.message = "Правильные Паспортные Данные " + fullPassportVal.fullPassport;
            return(View(passport));
        }
Esempio n. 2
0
        private void SetText(int sel)
        {
            SqlDataReader reader;

            Ser.Text          = o[sel].id.Substring(0, 3);
            Num.Text          = o[sel].id.Substring(3);
            BegDateTime.Value = o[sel].BegDate;
            EndDateTime.Value = o[sel].EndDate;
            ConDate.Value     = o[sel].ConDate;
            Price.Text        = o[sel].Price.ToString();

            reader = Sql.SelectById("Passport", o[sel].IdInsurant);
            reader.Read();
            PassPort insurant = new PassPort(reader);

            reader.Close();
            Insurant.Text = insurant.FullName;

            reader = Sql.SelectById("Passport", o[sel].IdOwner);
            reader.Read();
            PassPort owner = new PassPort(reader);

            reader.Close();
            Proprietor.Text = owner.FullName;

            reader = Sql.SelectById("Cars", o[sel].IdCar);
            reader.Read();
            Car car = new Car(reader);

            reader.Close();
            CarNum.Text   = car.GosNum;
            IdCar.Text    = car.id;
            Model.Text    = car.Model;
            Mark.Text     = car.Mark;
            Track.Checked = car.track;

            Prev.Visible = index != 0;
            Next.Visible = index != (o.Count - 1);
        }
Esempio n. 3
0
        private void AddClick(object sender, EventArgs e)
        {
            if (InsertInsurant == false)
            {
                int    idinsurant  = 1 + Sql.CountInTable("Passport");
                string insurantFio = Insurant.Text;
                insurant = new PassPort(idinsurant, insurantFio);
                if (Sql.TryInsert("Passport", insurant))
                {
                    InsertInsurant = true;
                }
            }

            if (Insertowner == false)
            {
                int    idowner  = 1 + Sql.CountInTable("Passport");
                string ownerFio = Proprietor.Text;
                owner = new PassPort(idowner, ownerFio);
                if (Sql.TryInsert("Passport", owner))
                {
                    Insertowner = true;
                }
            }

            if (Insertcar == false)
            {
                string carMake = CarMake.Text;
                string model   = Model.Text;
                string idCar   = IdCar.Text;
                string gosNum  = GosNum.Text;
                bool   track   = checkBox1.Checked;
                car = new Car(idCar, gosNum, carMake, model, track);
                if (Sql.TryInsert("Cars", car))
                {
                    Insertcar       = true;
                    IdCar.BackColor = Color.White;
                }
                else
                {
                    IdCar.BackColor = Color.OrangeRed;
                    MessageBox.Show("Неверная ИН транспорта\n транспорт уже присутствует в базе");
                }
            }

            if (Insertosago == false && Insertcar == true)
            {
                string   SerNum  = Ser.Text + Num.Text;
                DateTime Begdate = BegDate.Value;
                DateTime Enddate = EndDate.Value;

                Int32.TryParse(Price.Text, out int price);
                DateTime conDate = ConDate.Value;

                osago = new Osago(SerNum, insurant.id, owner.id, car.id, "0", Begdate, Enddate, conDate, price);
                if (Sql.TryInsert("Osago", osago))
                {
                    Insertosago   = true;
                    Ser.BackColor = Color.White;
                    Num.BackColor = Color.White;
                }
                else
                {
                    Ser.BackColor = Color.OrangeRed;
                    Num.BackColor = Color.OrangeRed;
                    MessageBox.Show("Неверная Серия или Номер Полиса ОСАГО\nТребуется изменить");
                }
            }

            if (Insertcar && Insertosago)
            {
                Clear();
            }
        }