상속: MonoBehaviour
예제 #1
0
 private void cbDriver_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         SplashScreenManager.ShowForm(desk, typeof(PleaseWaitForm), false, false, false);
         if (cbDriver.EditValue != DBNull.Value && Convert.ToInt64(cbDriver.EditValue) > 0)
         {
             if (IsNew)
             {
                 driver d = driver.SingleOrDefault(cbDriver.EditValue);
                 tfPercentComissionGross.EditValue = d.comission;
             }
         }
         else
         {
             tfPercentComissionGross.EditValue = 0;
         }
         SplashScreenManager.CloseForm(false);
     }
     catch (Exception ex)
     {
         SplashScreenManager.CloseForm(false);
         XtraMessageBox.Show(String.Format("Ocorreu um erro:\n\n{0}\n{1}", ex.Message, ex.InnerException));
     }
 }
예제 #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!validator.Validate())
     {
         return;
     }
     if (error)
     {
         return;
     }
     try
     {
         driver d = ((driver)bdgDriver.Current);
         d.Save();
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(String.Format("{0}\n\n{1}", ex.Message, ex.InnerException));
     }
     finally
     {
         if (this.MessageToSave("Motorista"))
         {
             desk.AddTabAndCloseCurrent(new DriverForm(null), "Novo Motorista", false);
         }
     }
 }
예제 #3
0
        // GET: drivers/Edit/5
        public ActionResult Edit(long?id)
        {
            if (Config.getCookie("logged") == "")
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            driver driver = db.drivers.Find(id);
            string phone  = driver.phone;
            //string car_number=driver.car_number;
            var p = db.list_online.Where(o => o.phone == phone).FirstOrDefault();

            try {
                ViewBag.lon = p.lon;
                ViewBag.lat = p.lat;
            }
            catch (Exception ex)
            {
                ViewBag.lon = 105.3724793;
                ViewBag.lat = 20.9740874;
            }
            if (driver == null)
            {
                return(HttpNotFound());
            }
            return(View(driver));
        }
예제 #4
0
        public IHttpActionResult Postdriver(driver driver)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.drivers.Add(driver);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (driverExists(driver.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = driver.ID }, driver));
        }
예제 #5
0
파일: DBManage.cs 프로젝트: MrNKP/DADBF1
        // ===== Driver =====
        public driver CreateDriver(string fn, string n, string c, DateTime b, int p, int e, int t, int num, int pts)
        {
            driver d = db.drivers.Where(p1 => (p1.family_name == fn) && (p1.name == n) && (p1.country == c) && (p1.birth == b) && (p1.podiums == p) && (p1.experience == e) && (p1.trophies == t) && (p1.number == num) && (p1.points == pts)).FirstOrDefault();

            if (d != null)
            {
                return(null);
            }
            else
            {
                d             = new driver();
                d.family_name = fn;
                d.name        = n;
                d.country     = c;
                d.birth       = b;
                d.podiums     = p;
                d.experience  = e;
                d.trophies    = t;
                d.number      = num;
                d.points      = pts;
                db.drivers.Add(d);
                db.SaveChanges();
                return(d);
            }
        }
예제 #6
0
파일: DBManage.cs 프로젝트: MrNKP/DADBF1
        public bool EditDriver(int id, string fn, string n, string c, DateTime b, int p, int e, int t, int num, int pts)
        {
            driver d = db.drivers.Find(id);

            if (d != null)
            {
                d.family_name = fn;
                d.name        = n;
                d.country     = c;
                d.birth       = b;
                d.podiums     = p;
                d.experience  = e;
                d.trophies    = t;
                d.number      = num;
                d.points      = pts;
                try
                {
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
                return(true);
            }
            return(false);
        }
예제 #7
0
        static void Main(string[] args)
        {
            driver person = new driver();
            ICard  card   = new BcCard();

            person.Driver(card);
        }
예제 #8
0
        public DriverForm(driver d)
        {
            InitializeComponent();
            ControlsUtil.SetBackColor(this.Controls);
            lbBirthday.Text = "";
            bdgState.DataSource = state.Fetch("");
            address ad;
            if (d == null)
                IsNew = true;
            if (IsNew)
            {
                d = new driver() { birthday = null, admitted_at = null, dismissed_at = null, genre = -1 };
                ad = new address();
                btnFiles.Enabled = false;
            }
            else
            {
                ad = address.SingleOrDefault(d.address);
                tfCpf.Properties.ReadOnly = true;
                //tfNumberCnh.Properties.ReadOnly = true;

                if (d.inactive)
                {
                    pnGeneral.Enabled = false;
                    btnSave.Visible = false;
                }
            }
            bdgAddress.DataSource = ad;
            bdgDriver.DataSource = d;
            DateTime now = driver.Now();
            tfBirthday.Properties.MaxValue = now;
            tfAdmittedAt.Properties.MaxValue = now;
            tfDismissedAt.Properties.MaxValue = now;
        }
    // Use this for initialization
    void Start()
    {
        GameObject bankObj = GameObject.FindGameObjectWithTag("Bank");

        bank   = bankObj.GetComponent <Banker>();
        Dragon = GameObject.FindGameObjectWithTag("Dragon").GetComponent <driver>();
    }
예제 #10
0
            public static bool CNHDriverIsUnique(driver c)
            {
                try
                {
                    string s = TruckSystemRepo.GetInstance().ExecuteScalar <string>
                                   ("SELECT COUNT(id) FROM drivers WHERE number_cnh=@0", c.number_cnh);
                    int count;
                    if (s.Equals(DBNull.Value) || String.IsNullOrEmpty(s))
                    {
                        count = 0;
                    }
                    else
                    {
                        count = Convert.ToInt32(s);
                    }

                    if (count == 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message, ex.InnerException);
                }
            }
예제 #11
0
        public IHttpActionResult Putdriver(int id, driver driver)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != driver.ID)
            {
                return(BadRequest());
            }

            db.Entry(driver).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!driverExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #12
0
        //[HttpPost]
        //public ActionResult updateNote(long? id, string note_driver)
        //{
        //    string updated = "";
        //    try
        //    {
        //        var update = (from s in db.driver_info where s.driver_id == id select s).FirstOrDefault();
        //        if (update != null)
        //        {
        //            update.driver_note = note_driver ?? null;
        //            db.Entry(update).State = EntityState.Modified;
        //            db.SaveChanges();
        //            updated = "1";
        //        }
        //        else
        //        {
        //            driver_info ghichu = new driver_info();
        //            ghichu.driver_id = id;
        //            ghichu.driver_note = note_driver ?? null;
        //            db.driver_info.Add(ghichu);
        //            db.SaveChanges();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Config.SaveTolog(ex.ToString());
        //    }
        //    return Json(updated, JsonRequestBehavior.AllowGet);
        //}

        //[HttpPost]
        //public ActionResult updateInfo(long? id, string des)
        //{
        //    string updated = "";
        //    try
        //    {
        //        var update = (from s in db.driver_info where s.driver_id == id select s).FirstOrDefault();
        //        if (update != null)
        //        {
        //            update.driver_des = des ?? null;
        //            db.Entry(update).State = EntityState.Modified;
        //            db.SaveChanges();
        //            updated = "1";
        //        }
        //        else
        //        {
        //            driver_info ghichu = new driver_info();
        //            ghichu.driver_id = id;
        //            ghichu.driver_des = des ?? null;
        //            db.driver_info.Add(ghichu);
        //            db.SaveChanges();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Config.SaveTolog(ex.ToString());
        //    }
        //    return Json(updated, JsonRequestBehavior.AllowGet);
        //}

        public ActionResult driverEdit()
        {
            if (Config.getCookie("taixelogged") == "")
            {
                return(RedirectToRoute("taixedangnhap"));
            }
            var  id_taixe  = Config.getCookie("taixelogged").Split(',').Last();
            long id_driver = Convert.ToInt64(id_taixe);

            driver driver = db.drivers.Find(id_driver);
            string phone  = driver.phone;
            //string car_number=driver.car_number;
            var p = db.list_online.Where(o => o.phone == phone).FirstOrDefault();

            try
            {
                ViewBag.lon = p.lon;
                ViewBag.lat = p.lat;
            }
            catch (Exception ex)
            {
                ViewBag.lon = 105.3724793;
                ViewBag.lat = 20.9740874;
            }
            if (driver == null)
            {
                return(HttpNotFound());
            }
            return(View(driver));
        }
예제 #13
0
        public DriverPresentationStub(driver dbItem)
        {
            //kamus
            EnumHelper eh = new EnumHelper();

            //algoritma
            this.Id            = dbItem.id;
            this.Name          = dbItem.name;
            this.Username      = dbItem.username;
            this.DriverType    = dbItem.driver_type;
            this.PhoneNumber   = dbItem.phone_number;
            this.Address       = dbItem.address;
            this.City          = dbItem.city;
            this.Email         = dbItem.email;
            this.IdOwner       = dbItem.id_owner;
            this.DeviceId      = dbItem.device_id;
            this.OwnerName     = dbItem.owner != null ? dbItem.owner.name : "";
            this.DriverLicense = dbItem.driver_license_file;
            this.WorkStartDate = dbItem.work_start_date;
            if (dbItem.photo == null)
            {
                this.Photo = VirtualPathUtility.ToAbsolute("~/Content/theme/noimage.png");
            }
            else
            {
                this.Photo = VirtualPathUtility.ToAbsolute(dbItem.photo);
            }

            DriverType type = (DriverType)Enum.Parse(typeof(Common.Enums.DriverType), dbItem.driver_type);

            TypeName = eh.GetEnumDescription(type);
        }
예제 #14
0
        public ViewResult Detail(Guid id)
        {
            driver dbItem = RepoDriver.FindByPk(id);
            DriverPresentationStub model = new DriverPresentationStub(dbItem);

            return(View(model));
        }
예제 #15
0
        public virtual ActionResult ChangePassword(DriverPasswordFormStub model)
        {
            driver driver = RepoDriver.FindByPk(model.Id);

            if (ModelState.IsValid)
            {
                bool changePasswordSucceeded;

                try
                {
                    MembershipUser currentUser = System.Web.Security.Membership.GetUser(driver.username);
                    changePasswordSucceeded = currentUser.ChangePassword(currentUser.ResetPassword(), model.NewPassword);
                }
                catch (Exception)
                {
                    changePasswordSucceeded = false;
                }

                if (changePasswordSucceeded)
                {
                    string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "ChangePassword").ToString();
                    this.SetMessage(template);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
                }
            }

            ViewBag.Username = driver.username;

            return(View("ChangePasswordForm"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            driver driver = db.drivers.Find(id);

            db.drivers.Remove(driver);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #17
0
 public IActionResult Create(driver cust)
 {
     if (ModelState.IsValid)
     {
         driverRepository.Add(cust);
         return(Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_Index", driverRepository.FindAll()) }));
     }
     return(Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "_Index", cust) }));
 }
예제 #18
0
        public virtual ActionResult ChangePassword(Guid id)
        {
            DriverPasswordFormStub viewModel = new DriverPasswordFormStub();
            driver driver = RepoDriver.FindByPk(id);

            ViewBag.Username = driver.username;

            return(View("ChangePasswordForm", viewModel));
        }
예제 #19
0
 public IActionResult Edit(driver obj)
 {
     if (ModelState.IsValid)
     {
         driverRepository.Update(obj);
         return(Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_Index", driverRepository.FindAll()) }));
     }
     return(Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "_Index", obj) }));
 }
 public ActionResult Edit([Bind(Include = "driver_id,driver_name,phone_number,driver_address,gender,date_of_birth")] driver driver)
 {
     if (ModelState.IsValid)
     {
         db.Entry(driver).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(driver));
 }
예제 #21
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            driver d = ((driver)bdgDrivers.Current);

            if (d != null)
            {
                DriverForm df = new DriverForm(d);
                desk.AddTab(df, "Edição de Motorista", true);
            }
        }
예제 #22
0
 public ActionResult Edit([Bind(Include = "id,employeeName,employeeMidName,employeeSurname,employeeIdNumber,employeeEmail,employeePhonenumber,employeeProfilePic,employeeCv,employeeIdDocument,employeeQualification,country,street_number,route,administrative_area_level_1,locality,postal_code,fullAdress,isStillEmployeed,reasonLeft,addedByEmail,dateRegistered")] driver driver)
 {
     if (ModelState.IsValid)
     {
         db.Entry(driver).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(driver));
 }
예제 #23
0
        private void LoadDriver()
        {
            currentDriver = (from driver in DBHolder.DB.drivers
                             where driver.id == driverId
                             select driver).First();
            string avatar_path = AppDomain.CurrentDomain.BaseDirectory + "photo/" + currentDriver.photo;

            //FirstNameField.Text = avatar_path;
            Avatar.Source = new BitmapImage(new Uri(avatar_path));
        }
예제 #24
0
        public ActionResult Detail(Guid id, DateTime startDate, DateTime endDate)
        {
            DailyFilterModel filter = new DailyFilterModel(startDate, endDate);
            driver           d      = RepoDriver.FindByPk(id);

            ViewBag.DriverId   = id;
            ViewBag.DriverName = d.name;

            return(View(filter));
        }
예제 #25
0
        public IHttpActionResult Getdriver(int id)
        {
            driver driver = db.drivers.Find(id);

            if (driver == null)
            {
                return(NotFound());
            }

            return(Ok(driver));
        }
예제 #26
0
        public driver Getdriver()
        {
            var    identityClaims = (ClaimsIdentity)User.Identity;
            driver model          = new driver()
            {
                firstname = identityClaims.FindFirst("firstname").Value,
                ID        = Convert.ToInt32(identityClaims.FindFirst("ID").Value),
            };

            return(model);
        }
예제 #27
0
        public ActionResult DeleteConfirmed(long id)
        {
            if (Config.getCookie("logged") == "")
            {
                return(RedirectToAction("Login", "Home"));
            }
            driver driver = db.drivers.Find(id);

            db.drivers.Remove(driver);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #28
0
파일: DBManage.cs 프로젝트: MrNKP/DADBF1
        public bool DeleteDriver(int id)
        {
            driver d = db.drivers.Find(id);

            if (d != null)
            {
                db.drivers.Remove(d);
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
예제 #29
0
        public IHttpActionResult Getdriver(string driveremail, string password)
        {
            driver driver = db.drivers.Where(drivers => drivers.driveremail.Equals(driveremail) &&
                                             drivers.password.Equals(password)).FirstOrDefault();

            if (driveremail == null && password == null)
            {
                return(NotFound());
            }

            return(Ok(driver));
        }
예제 #30
0
        public IHttpActionResult Postdriver(driver driver)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.drivers.Add(driver);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = driver.driverId }, driver));
        }
예제 #31
0
 public AddOrUpdateDriver()
 {
     try
     {
         InitializeComponent();
         this.driver = new driver();
         LoadGender();
     }
     catch (Exception ex)
     {
         MsgBox.Error(ex.Message);
     }
 }
예제 #32
0
 public void TestMethod1()
 {
     Driver = new driver();
     Driver.Navigate().GoToUrl(Wrapper.GetUrl());
     Assert.IsTrue(Driver.Title == "Яндекс");
 }
예제 #33
0
            public static bool CPFDriverIsUnique(driver c)
            {
                try
                {
                    string s = TruckSystemRepo.GetInstance().ExecuteScalar<string>
                        ("SELECT COUNT(id) FROM drivers WHERE document=@0", c.cpf);
                    int count;
                    if (s.Equals(DBNull.Value) || String.IsNullOrEmpty(s))
                        count = 0;
                    else
                        count = Convert.ToInt32(s);

                    if (count == 0)
                        return true;
                    else
                        return false;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message, ex.InnerException);
                }
            }