Beispiel #1
0
        void kbtnNew_Click(object sender, EventArgs e)
        {
            var holder = new HolderInfo
            {
                DateOfBirth = DrivingLicense.MinDate
            };

            var dl = new DrivingLicense
            {
                Id           = 0,
                Holder       = holder,
                DateOfIssue  = DateTime.Now,
                DateOfExpiry = DateTime.Now.AddYears(ValidityPeriod),
                Status       = TextUI.InWait
            };

            var frm = new DrivingLicenseObjectForm {
                Object = dl, ShowInTaskbar = false
            };
            var dr = frm.ShowDialog();

            if (dr == DialogResult.OK)
            {
                FillDataGrid();
            }
        }
Beispiel #2
0
        async void PostSignature(DrivingLicense obj)
        {
            var wait = new WaitForm {
                Status = TextUI.SavingData, OwnerForm = this
            };

            wait.Show();
            var rs = await obj.PostSignature();

            wait.Close();
            wait.Dispose();

            if (rs.StatusCode == HttpStatusCode.OK)
            {
                var error = ApiResponse.ParseError(rs.Content);
                if (!String.IsNullOrEmpty(error))
                {
                    MessageBox.Show(error);
                }
                else
                {
                    pbSignature.Image = GraphicsHelper.GetStretchedImage(obj.Signature, pbSignature.Height, pbSignature.Width);
                    pbSignature.Refresh();
                }
            }
            else
            {
                MessageBox.Show(ErrorTexts.FailedToSendDataToServer);
            }
            FillDataGrid();
        }
Beispiel #3
0
        public ActionResult ViewDetail()
        {
            //当前登录用户

            ViewBag.Title = "驾驶证详情";;
            MpUserID      = new Guid("E8325C13-9C76-4B70-911E-57395A2F4D69");
            MpUser mpUser = _mpUserService.GetById(MpUserID);

            if (mpUser == null || mpUser.IsAuth != 1)
            {
                return(Json(new { message = "您没有权限,请先申请成为业务员!" }));
            }
            DrivingLicense drivingLicense = new DrivingLicense();

            if (!string.IsNullOrWhiteSpace(RQuery["Id"]))
            {
                drivingLicense = _drivingLicenseService.GetById(new Guid(RQuery["Id"]));
            }
            //VehicleLicense vehicleLicense = _vehicleLicenseService.GetUnique("from VehicleLicense where Id = '" +id +  "'");

            if (drivingLicense != null && drivingLicense.MpUserId != Guid.Empty && drivingLicense.MpUserId != MpUserID)
            {
                return(Json(new { message = "您没有权限,请先申请成为业务员!" }));
            }
            return(View(drivingLicense));
        }
Beispiel #4
0
        async void PostPublishedStatus(DrivingLicense obj)
        {
            kbtnPrint.Enabled = false;

            obj.Status = TextUI.Published;
            var wait = new WaitForm {
                Status = TextUI.SavingData, OwnerForm = this
            };

            wait.Show();
            var rs = await obj.PostPublishedStatus();

            wait.Close();
            wait.Dispose();

            if (rs.StatusCode == HttpStatusCode.OK)
            {
                var error = ApiResponse.ParseError(rs.Content);
                if (!String.IsNullOrEmpty(error))
                {
                    MessageBox.Show(error);
                }
                else
                {
                    var suc = obj.SendToPrint();
                    MessageBox.Show(!suc ? DrivingLicense.LastError : TextUI.DataTransferredToPrint);
                }
            }
            else
            {
                MessageBox.Show(ErrorTexts.FailedToSendDataToServer);
            }
            FillDataGrid();
        }
        public ActionResult AllotEditProvide(Guid id)
        {
            if (!base.HasPermission("DrivingLicense", PermissionOperate.track))
            {
                return(JsonMessage(false, "你没有分配业务员的权限"));
            }

            DrivingLicense drivingLicense = _drivingLicenseService.GetById(id);

            if (drivingLicense == null)
            {
                return(JsonMessage(false, "该笔行驶证已不存在,不能继续操作!"));
            }
            string bussMan     = RQuery["AssignBussinessMan"].ToString();
            string bussPhone   = RQuery["BussinessManPhone"].ToString();
            MpUser bussManUser = _mpUserService.GetUnique("from MpUser where Name = '" + bussMan.Trim() + "' and MobilePhone = '" + bussPhone.Trim() + "'");

            if (bussManUser == null)
            {
                return(JsonMessage(false, "业务员信息有错!"));
            }
            drivingLicense.MpUserId = bussManUser.Id;
            _drivingLicenseService.Update(drivingLicense);

            base.AddLog(string.Format("分配业务员[{0}]成功", drivingLicense.Name + "To" + bussMan.Trim()), AdminLoggerModuleEnum.DrivingLicense);
            return(JsonMessage(true, "处理成功"));
        }
Beispiel #6
0
 public DrivingLicenseDTO(DrivingLicense drivingLicense)
 {
     this.Id         = drivingLicense.Id;
     this.CreateDate = drivingLicense.CreateDate;
     this.Name       = drivingLicense.Name;
     this.CertNo     = drivingLicense.CertNo;
 }
        public ActionResult DrivingLicenseProvide()
        {
            if (string.IsNullOrWhiteSpace(RQuery["DrivingLicenseId"]))
            {
                if (!base.HasPermission("DrivingLicense", PermissionOperate.add))
                {
                    return(JsonMessage(false, "你没有添加驾驶证的权限"));
                }
            }
            else
            {
                if (!base.HasPermission("DrivingLicense", PermissionOperate.edit))
                {
                    return(JsonMessage(false, "你没有编辑驾驶证的权限"));
                }
            }


            DrivingLicense drivingLicense = new DrivingLicense();

            if (!string.IsNullOrWhiteSpace(RQuery["DrivingLicenseId"]))
            {
                drivingLicense = _drivingLicenseService.GetById(new Guid(RQuery["DrivingLicenseId"]));
            }
            try
            {
                UpdateModel <DrivingLicense>(drivingLicense);
            }
            catch (System.Exception ex)
            {
                //
            }
            if (string.IsNullOrWhiteSpace(RQuery["DrivingLicenseId"]))
            {
                //branch.Status = 1;
                try
                {
                    drivingLicense.CreateDate = DateTime.Now;
                    _drivingLicenseService.Insert(drivingLicense);
                    base.AddLog(string.Format("添加驾驶证[{0}]成功", drivingLicense.Name), AdminLoggerModuleEnum.DrivingLicense);
                }
                catch (System.Exception ex)
                {
                    //
                }
                return(JsonMessage(true, "添加驾驶证成功"));
            }
            else
            {
                _drivingLicenseService.Update(drivingLicense);
                base.AddLog(string.Format("修改驾驶证[{0}]成功", drivingLicense.Name), AdminLoggerModuleEnum.DrivingLicense);
                return(JsonMessage(true, "修改驾驶证成功"));
            }
        }
        public ActionResult DrivingLicenseEdit()
        {
            if (!base.HasPermission("DrivingLicense", PermissionOperate.add) && !base.HasPermission("DrivingLicense", PermissionOperate.edit))
            {
                return(base.ShowNotPermissionTip(""));
            }

            string         id             = RQuery["Id"];
            DrivingLicense drivingLicense = string.IsNullOrWhiteSpace(id) ? null : _drivingLicenseService.GetById(new Guid(id));

            return(AdminView(drivingLicense));
        }
Beispiel #9
0
 public Person(string currZone)
 {
     ZoneID = currZone;
     Age = Age.EighteenToTwentyFive;
     Sex = Sex.Male;
     EducationLevel = EducationLevel.primary;
     household = new Household();
     Occupation = Occupation.TradesProfessional;
     PublicTransitPass = PublicTransitPass.MetroPass;
     EmploymentStatus = EmploymentStatus.PartTime;
     DrivingLicense = DrivingLicense.No;
     Type = AgentType.Person;
     myID = idCounter++;
 }
Beispiel #10
0
 private Person(Person original)
 {
     Type = AgentType.Person;
     //copy the values
     ZoneID = original.ZoneID;
     Age = original.Age;
     Sex = original.Sex;
     EducationLevel = original.EducationLevel;
     Occupation = original.Occupation;
     PublicTransitPass = original.PublicTransitPass;
     EmploymentStatus = original.EmploymentStatus;
     DrivingLicense = original.DrivingLicense;
     household = original.household;
     myID = idCounter++;
 }
 public ActionResult DrivingLicenseProvide(Guid id)
 {
     if (!base.HasPermission("DrivingLicense", PermissionOperate.delete))
     {
         return(JsonMessage(false, "你没有删除驾驶证的权限"));
     }
     try
     {
         DrivingLicense drivingLicense = _drivingLicenseService.GetById(id);
         _drivingLicenseService.Delete(id.ToString());
         base.AddLog(string.Format("删除驾驶证[{0}]成功", drivingLicense.Name), AdminLoggerModuleEnum.Branch);
     }
     catch (System.Exception ex)
     {
     }
     return(JsonMessage(true, "删除成功"));
 }
Beispiel #12
0
 public Schema()
     : base()
 {
     InstanceType = typeof(__Checkbox__);
     ClassName    = "CheckboxPage";
     Properties.ClearExposed();
     Html = Add <__TString__>("Html");
     Html.DefaultValue = "/KitchenSink/CheckboxPage.html";
     Html.SetCustomAccessors((_p_) => { return(((__Checkbox__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Checkbox__)_p_).__bf__Html__ = (System.String)_v_; }, false);
     DrivingLicense = Add <__TBool__>("DrivingLicense$");
     DrivingLicense.DefaultValue = true;
     DrivingLicense.Editable     = true;
     DrivingLicense.SetCustomAccessors((_p_) => { return(((__Checkbox__)_p_).__bf__DrivingLicense__); }, (_p_, _v_) => { ((__Checkbox__)_p_).__bf__DrivingLicense__ = (System.Boolean)_v_; }, false);
     DrivingLicenseReaction = Add <__TString__>("DrivingLicenseReaction", bind: "CalculatedDrivingLicenseReaction");
     DrivingLicenseReaction.DefaultValue = "";
     DrivingLicenseReaction.SetCustomAccessors((_p_) => { return(((__Checkbox__)_p_).__bf__DrivingLicenseReaction__); }, (_p_, _v_) => { ((__Checkbox__)_p_).__bf__DrivingLicenseReaction__ = (System.String)_v_; }, false);
 }
        public ActionResult GetBussManDetail(Guid id)
        {
            if (!base.HasPermission("DrivingLicense", PermissionOperate.track))
            {
                return(null);
            }

            DrivingLicense drivingLicense = _drivingLicenseService.GetById(id);

            if (drivingLicense == null || drivingLicense.MpUserId == Guid.Empty)
            {
                return(Json(new { AssignBussinessMan = "", BussinessManPhone = "" }));
            }
            MpUser bussMan = _mpUserService.GetById(drivingLicense.MpUserId);

            if (bussMan == null)
            {
                return(Json(new { AssignBussinessMan = "", BussinessManPhone = "" }));
            }
            return(Json(new { AssignBussinessMan = bussMan.Name, BussinessManPhone = bussMan.MobilePhone }));
        }
Beispiel #14
0
        public ActionResult DrivingLicenseApplyProvide(string isEdit)
        {
            DrivingLicense drivingLicense = new DrivingLicense();

            if (!string.IsNullOrWhiteSpace(RQuery["Id"]))
            {
                drivingLicense = _drivingLicenseService.GetById(new Guid(RQuery["Id"]));
            }

            UpdateModel <DrivingLicense>(drivingLicense);
            if (string.IsNullOrWhiteSpace(RQuery["Id"]))
            {
                drivingLicense.CreateDate = DateTime.Now;
                _drivingLicenseService.Insert(drivingLicense);
                return(JsonMessage(true, "添加驾驶证成功"));
            }
            else
            {
                _drivingLicenseService.Update(drivingLicense);
                return(JsonMessage(true, "修改驾驶证成功"));
            }
        }
Beispiel #15
0
        async void FillDataGrid()
        {
            kdgvData.EndEdit();
            var newSrc = new BindingSource();
            var curSrc = (BindingSource)kdgvData.DataSource;

            kdgvData.DataSource = newSrc;
            if (!ReferenceEquals(curSrc.DataSource, null))
            {
                var v = (BindingListView <DrivingLicense>)curSrc.DataSource;
                v.DataSource = new List <DrivingLicense>();
            }
            //curSrc.Clear();

            var wait = new WaitForm {
                Status = TextUI.RetrievingData, OwnerForm = this
            };

            wait.Show();
            var data = await DrivingLicense.GetDrivingLicenses((int)pcPage.CurrentPage, (int)pcPage.PageSize);

            wait.Close();
            wait.Dispose();
            if (ReferenceEquals(data, null))
            {
                MessageBox.Show(ErrorTexts.FailedToGetDataFromServer);
            }
            else
            {
                pcPage.TotalRecords = data.TotalNumber;
                var view = new BindingListView <DrivingLicense>(data.Items);
                curSrc.DataSource = view; //data.Items;
            }

            kdgvData.DataSource = curSrc;
            newSrc.Dispose();
            kdgvData.Invalidate();
        }
Beispiel #16
0
 public ActionResult AddLicense(DrivingLicense drivingLicense)
 {
     ((RentalWizardModel)Session["RentalWizard"]).DrivingLicense = drivingLicense;
     return(RedirectToAction("CarSelection"));
 }
Beispiel #17
0
 private void SaveDrivingLicenseToDb(DrivingLicense drivingLicense)
 {
     db.DrivingLicense.Add(drivingLicense);
     db.SaveChanges();
 }
Beispiel #18
0
        public static void FillByDriverLicense(List <ITask> rs)
        {
            var db    = new DbHelper(Setting.DlDbPath);
            var table = db.FetchAll("PrintQueue", String.Format("WHERE Status = '{0}'", Texts.Published));

            if (ReferenceEquals(table, null))
            {
                return;
            }

            for (var i = 0; i < table.Rows.Count; i++)
            {
                var row              = table.Rows[i];
                var lastName         = row["LastName"].ConvertTo <string>();
                var firstName        = row["FirstName"].ConvertTo <string>();
                var middleName       = row["MiddleName"].ConvertTo <string>();
                var personalNumber   = row["PersonalNumber"].ConvertTo <string>();
                var cardNumber       = row["CardNumber"].ConvertTo <string>();
                var placeOfResidence = row["PlaceOfResidence"].ConvertTo <string>();
                var category         = row["Category"].ConvertTo <string>();
                var status           = row["Status"].ConvertTo <string>();

                var dateOfBirth  = row["DateOfBirth"].ConvertTo <DateTime>();
                var dateOfIssue  = row["DateOfIssue"].ConvertTo <DateTime>();
                var dateOfExpiry = row["DateOfExpiry"].ConvertTo <DateTime>();

                var photo = row["Photo"].ConvertTo <string>();
                var sign  = row["Signature"].ConvertTo <string>();

                var region         = row["Region"].ConvertTo <string>();
                var district       = row["District"].ConvertTo <string>();
                var placeOfBirth   = row["PlaceOfBirth"].ConvertTo <string>();
                var placeOfIssue   = row["PlaceOfIssue"].ConvertTo <string>();
                var passportSeries = row["PassportSeries"].ConvertTo <string>();
                var passportNumber = row["PassportNumber"].ConvertTo <int>();
                var licenseId      = row["LicenseId"].ConvertTo <long>();

                var location = new Location
                {
                    Region   = region,
                    District = district,
                    Address  = placeOfResidence
                };

                var holder = new HolderInfo
                {
                    LastName         = lastName,
                    FirstName        = firstName,
                    MiddleName       = middleName,
                    PlaceOfBirth     = placeOfBirth,
                    PersonalNumber   = personalNumber,
                    DateOfBirth      = dateOfBirth,
                    PlaceOfResidence = location,
                    PhotoData        = photo,
                    SignatureData    = sign,
                    Passport         = new Passport {
                        Seria = passportSeries, Number = passportNumber
                    }
                };

                var item = new DrivingLicense
                {
                    Id           = licenseId,
                    Holder       = holder,
                    CardNumber   = cardNumber,
                    PlaceOfIssue = placeOfIssue,
                    DateOfIssue  = dateOfIssue,
                    DateOfExpiry = dateOfExpiry,
                    Category     = category,
                    CategoryList = Category.Deserialize(category).ToArray(),
                    Status       = status
                };
                rs.Add(item);
            }
        }
Beispiel #19
0
 public void SetDrivingLicense(DrivingLicense curDL)
 {
     DrivingLicense = curDL;
 }