コード例 #1
0
        public async Task AddOwner(OwnerInformation ownerInformation)
        {
            var owner = _mapper.Map <Owner>(ownerInformation);
            await _context.Owners.AddAsync(owner);

            await _context.SaveChangesAsync();
        }
コード例 #2
0
        public async Task UpdateOwner(OwnerInformation ownerInformation)
        {
            var owner = _mapper.Map <Owner>(ownerInformation);

            _context.Update(owner);

            await _context.SaveChangesAsync();
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(string id)
        {
            OwnerInformation ownerInformation = db.OwnerInformations.Find(id);

            db.OwnerInformations.Remove(ownerInformation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "UserID,FirstName,LastName,MainPhoneNumber,SecondaryPhoneNumber,Email,Address,City,State,ZipCode")] OwnerInformation ownerInformation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ownerInformation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.OwnerInformations, "UserID", "FullName", ownerInformation.UserID);
     return(View(ownerInformation));
 }
コード例 #5
0
        public async Task AddOwner(OwnerInformation ownerInformation)
        {
            var log = new Log()
            {
                Name = "AddOwner",
                Time = DateTime.Now
            };

            await _collection.InsertOneAsync(log);

            await _repository.AddOwner(ownerInformation);
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "UserID,FirstName,LastName,MainPhoneNumber,SecondaryPhoneNumber,Email,Address,City,State,ZipCode")] OwnerInformation ownerInformation)
        {
            if (ModelState.IsValid)
            {
                db.OwnerInformations.Add(ownerInformation);
                db.SaveChanges();
                //TempData["assetMessage"] = "You have successfully entered your Owner Information.  Please fill in the information below for the Animal Client.";
                return(RedirectToAction("Create", "OwnerAssets"));
            }

            ViewBag.UserID = new SelectList(db.OwnerInformations, "UserID", "FullName", ownerInformation.UserID);
            return(View(ownerInformation));
        }
コード例 #7
0
        public async Task UpdateOwner(OwnerInformation ownerInformation)
        {
            var log = new Log()
            {
                Name  = "UpdateOwner",
                Time  = DateTime.Now,
                Index = ownerInformation.OwnerId
            };

            await _collection.InsertOneAsync(log);

            await _repository.UpdateOwner(ownerInformation);
        }
コード例 #8
0
        public void GetOwnerIdTest()
        {
            long id    = OwnerInformation.GetOwnerId(_databasePath, out var ownerName, out var ownerLic, out _errOut);
            bool value = id > 0;

            if (value)
            {
                TestContext.WriteLine($"id: {id}");
                TestContext.WriteLine($"owner name: {ownerName}");
                TestContext.WriteLine($"License: {ownerLic}");
            }
            General.HasTrueValue(value, _errOut);
        }
コード例 #9
0
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OwnerInformation ownerInformation = db.OwnerInformations.Find(id);

            if (ownerInformation == null)
            {
                return(HttpNotFound());
            }
            return(View(ownerInformation));
        }
コード例 #10
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    //var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    //await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");
                    //ViewBag.Link = callbackUrl;
                    //return View("DisplayEmail");
                    OwnerInformation newSiteUser = new OwnerInformation();
                    newSiteUser.UserID               = user.Id;
                    newSiteUser.FirstName            = model.FirstName;
                    newSiteUser.LastName             = model.LastName;
                    newSiteUser.Email                = model.Email;
                    newSiteUser.MainPhoneNumber      = model.MainPhoneNumber;
                    newSiteUser.SecondaryPhoneNumber = model.SecondaryPhoneNumber;
                    newSiteUser.Address              = model.Address;
                    newSiteUser.City    = model.City;
                    newSiteUser.State   = model.State;
                    newSiteUser.ZipCode = model.ZipCode;

                    DogueFinalProjectEntities db = new DogueFinalProjectEntities();
                    db.OwnerInformations.Add(newSiteUser);

                    db.SaveChanges();
                    if (User.IsInRole("Agent"))
                    {
                        var NewUser = UserManager;
                        NewUser.AddToRole(user.Id, "Client");
                    }

                    UserManager.AddToRole(user.Id, "Client");

                    //ViewBag.RegisterMessage("Thank you, for registering with the Dogue Client Portal.  You're halfway there.  Please, fill in the following information for the animal client.");
                    ViewBag.RegisterCompleteMessage = "Thank you. You have successfully completed full registration.  You may now take advanatage of all our client privileges. To take full advantage of all our site offers, please, take a few moments to fill in your Animal Client information.";
                    return(RedirectToAction("Create", "OwnerAssets"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #11
0
        public void LoginEnabledTest()
        {
            bool value = OwnerInformation.LoginEnabled(_databasePath, out var uid, out var pwd, out var forgotWord,
                                                       out var forgotPhrase, out _errOut);

            if (value)
            {
                TestContext.WriteLine($"uid: {uid}");
                TestContext.WriteLine($"pwd: {pwd}");
                TestContext.WriteLine($"forgot word: {forgotWord}");
                TestContext.WriteLine($"forgot phrase: {forgotPhrase}");
            }
            General.HasTrueValue(value, _errOut);
        }
コード例 #12
0
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OwnerInformation ownerInformation = db.OwnerInformations.Find(id);

            if (ownerInformation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserID = new SelectList(db.OwnerInformations, "UserID", "FullName", ownerInformation.UserID);
            return(View(ownerInformation));
        }
コード例 #13
0
        /// <summary>
        /// Create an empty object from <see cref="SiteBlue.Questionnaire.Data.OwnerInformation"/>
        /// class, with a reference to <see cref="SiteBlue.Questionnaire.Data.Questionnaire"/>
        /// </summary>
        /// <param name="QuestionnaireId">Questionnaire ID</param>
        /// <returns></returns>
        public static OwnerInformation InitializeOwnerInformation(long QuestionnaireId)
        {
            OwnerInformation ownerInformation = new OwnerInformation();

            ownerInformation.QuestionnaireId = QuestionnaireId;
            ownerInformation.FirstName       = "";
            ownerInformation.LastName        = "";
            ownerInformation.BusinessName    = "";
            ownerInformation.HomeAddress     = "";
            ownerInformation.City            = "";
            ownerInformation.StateId         = 1;
            ownerInformation.ZipCode         = "";
            ownerInformation.CellPhone       = "";
            ownerInformation.HomePhone       = "";
            ownerInformation.EmailAddress    = "";
            return(ownerInformation);
        }
        public ActionResult OwnerInformation(long?id, long?questionnaire)
        {
            OwnerInformation ownerInformation = null;

            if (id.HasValue)
            {
                ownerInformation = db.OwnerInformation.Find(id.Value);
            }
            if (questionnaire.HasValue)
            {
                ownerInformation = db.OwnerInformation.Single(oi => oi.QuestionnaireId == questionnaire.Value);
            }

            if (ownerInformation != null)
            {
                return(View(ownerInformation));
            }

            return(RedirectToAction("Index"));
        }
コード例 #15
0
        public void EditOwnerInformationTest()
        {
            long             id    = OwnerInformation.GetOwnerId(_databasePath, out var ownerName, out var ownerLic, out _errOut);
            List <OwnerInfo> lst   = OwnerInformation.GetOwnerInfo(_databasePath, out _errOut);
            bool             value = false;

            if (lst.Count > 0)
            {
                string username     = "";
                string password     = "";
                string forgotword   = "";
                string forgotphrase = "";
                string name         = "";
                string license      = "";
                string address      = "";
                string city         = "";
                string zipCode      = "";
                string state        = "";
                string phone        = "";
                foreach (OwnerInfo l in lst)
                {
                    username     = l.UserName;
                    password     = l.Password;
                    forgotword   = l.ForgotWord;
                    forgotphrase = l.ForgotPhrase;
                    name         = l.Name;
                    license      = l.Ccdwl;
                    address      = l.Address;
                    city         = l.City;
                    zipCode      = l.ZipCode;
                    state        = l.State;
                    phone        = l.Phone;
                }

                value = OwnerInformation.Update(_databasePath, id, $"UPDATED: {name}", address, city, state, zipCode,
                                                phone, license, true, password, username, forgotword, forgotphrase, out _errOut);
            }
            General.HasTrueValue(value, _errOut);
        }
コード例 #16
0
        /// <summary>
        /// Информация о владельце карты
        /// </summary>
        public OwnerModel ReadOwnerInformation(PolicySmartcardBase policy)
        {
            OwnerModel       result           = new OwnerModel();
            OwnerInformation ownerInformation = policy.GetOwnerInformation();

            if (ownerInformation == null)
            {
                return(result);
            }
            result.OwnerFamily = this.FormatPolicyText(ownerInformation.Identity_1, "Отсутствует");
            result.OwnerName   = this.FormatPolicyText(ownerInformation.Identity_2, "Отсутствует");
            result.OwnerSname  = this.FormatPolicyText(ownerInformation.Identity_3, "Отсутствует");
            byte?  sex = ownerInformation.Sex;
            string str;

            if ((sex.GetValueOrDefault() != (byte)1 ? 0 : (sex.HasValue ? 1 : 0)) == 0)
            {
                sex = ownerInformation.Sex;
                str = (sex.GetValueOrDefault() != (byte)2 ? 0 : (sex.HasValue ? 1 : 0)) != 0 ? "Женский" : "Неизвестно";
            }
            else
            {
                str = "Мужской";
            }
            result.OwnerSex     = str;
            result.OwnerBdate   = this.FormatPolicyDate(ownerInformation.BirthDate, "Отсутствует");
            result.OwnerBplace  = this.FormatPolicyText(ownerInformation.BirthPlace, "Отсутствует");
            result.PoliceNumber = ownerInformation.PolicyNumber;
            result.PoliceDate   = this.FormatPolicyDate(ownerInformation.ExpireDate, "Отсутствует");
            result.PoliceLong   = this.FormatPolicyDate(ownerInformation.ExpireDate, "Не ограничено");
            result.PoliceSnils  = this.FormatPolicyText(ownerInformation.SNILS, "Отсутствует");
            if (ownerInformation.Citizenship != null)
            {
                result.Gcode = this.FormatPolicyText(ownerInformation.Citizenship.CoutryCode, "Отсутствует");
                result.Gtext = this.FormatPolicyText(ownerInformation.Citizenship.CoutryCyrillicName, "Отсутствует");
            }
            return(result);
        }
コード例 #17
0
        public void GetOwnerInfoTest()
        {
            List <OwnerInfo> lst   = OwnerInformation.GetOwnerInfo(_databasePath, out _errOut);
            bool             value = lst.Count > 0;

            if (value)
            {
                foreach (OwnerInfo l in lst)
                {
                    TestContext.WriteLine($"uid: {l.UserName}");
                    TestContext.WriteLine($"pwd: {l.Password}");
                    TestContext.WriteLine($"forgot word: {l.ForgotWord}");
                    TestContext.WriteLine($"forgot phrase: {l.ForgotPhrase}");
                    TestContext.WriteLine($"name: {l.Name}");
                    TestContext.WriteLine($"License: {l.Ccdwl}");
                    TestContext.WriteLine($"Address: {l.Address}");
                    TestContext.WriteLine($"City: {l.City}");
                    TestContext.WriteLine($"ZipCode: {l.ZipCode}");
                    TestContext.WriteLine($"State: {l.State}");
                    TestContext.WriteLine($"id: {l.Id}");
                }
            }
            General.HasTrueValue(value, _errOut);
        }
コード例 #18
0
ファイル: MainForm.cs プロジェクト: Samojlov/OMSReader
        void GetCardData()
        {
            if (ReadersComboBox.Items.Count == 0)
            {
                MessageBox.Show("Не обнаружено подключенных ридеров!");
                return;
            }

            ClearForm();

            PCSCReadersManager manager = new PCSCReadersManager();

            var SA = ReadersComboBox.Items[0].ToString();

            manager.EstablishContext(SmartCard.PCSC.READERSCONTEXTSCOPE.SCOPE_USER);
            if (manager.OfType <ISCard>().Select(s => s.ReaderName).ToList().Contains(SA))
            {
                ISCard card = manager[SA];
                PolicySmartcardBase policy = new PolicySmartcardBase(card);
                policy.Connect();

                try
                {
                    OwnerInformation owner_info = policy.GetOwnerInformation();
                    if (owner_info != null)
                    {
                        textBoxFIO.Text          = FormatPolicyText(owner_info.Identity_1, "") + " " + FormatPolicyText(owner_info.Identity_2, "") + " " + FormatPolicyText(owner_info.Identity_1, "");
                        textBoxSex.Text          = owner_info.Sex == 1 ? "Мужской" : owner_info.Sex == 2 ? "Женский" : "Неизвестно";
                        textBoxDateOfBirth.Text  = FormatPolicyDate(owner_info.BirthDate, "Отсутствует");
                        textBoxPlaceOfBirth.Text = FormatPolicyText(owner_info.BirthPlace, "Отсутствует");

                        if (owner_info.Citizenship != null)
                        {
                            textBoxCountryCode.Text = FormatPolicyText(owner_info.Citizenship.CoutryCode, "Отсутствует");
                            textBoxCountryName.Text = FormatPolicyText(owner_info.Citizenship.CoutryCyrillicName, "Отсутствует");
                        }

                        textBoxPolisNumber.Text = owner_info.PolicyNumber;
                        textBoxPolisDate.Text   = FormatPolicyDate(owner_info.ExpireDate, "Отсутствует");
                        textBoxPolisExpire.Text = FormatPolicyDate(owner_info.ExpireDate, "Не ограничено");
                        textBoxSNILS.Text       = FormatPolicyText(owner_info.SNILS, "Отсутствует");
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Ошибка: ");
                }
                try
                {
                    CardID cid = policy.GetCardID();
                    if (cid != null)
                    {
                        textBoxCardSerial.Text  = cid.SerialNumber.ToHexString();
                        textBoxCardType.Text    = cid.CardType.ToString();
                        textBoxCardVersion.Text = cid.CardVersion.ToString();
                        textBoxCompanyID.Text   = cid.InstitutionID.ToHexString();
                        textBoxInformation.Text = cid.AdditionalInfo.ToHexString();
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Ошибка: ");
                }
                try
                {
                    ICCID ccd = policy.GetICCD();
                    if (ccd != null)
                    {
                        textBoxManufacturerCode.Text = ccd.IssuerCode.ToString();
                        textBoxManufacturerData.Text = ccd.IssuerData.ToHexString();
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Ошибка: ");
                }

                try
                {
                    SMOInformation smo = policy.GetCurrentSMOInformation();
                    if (smo != null)
                    {
                        textBoxOGRN.Text  = smo.OGRN;
                        textBoxOKATO.Text = smo.OKATO;
                        textBoxInsuranceStartDate.Text = FormatPolicyDate(smo.InsuranceStartDate, "Отсутствует");
                        textBoxExpire.Text             = FormatPolicyDate(smo.InsuranceExpireDate, "Не ограничено");
                        textBoxCert.Text = new X509Certificate2(smo.EDS.Certificate).Subject;
                        textBoxECP.Text  = smo.EDS.Signature.ToHexString();
                        //textBoxECPStatus.Text = smo.VerifyEDS() == true ? "Верна" : "Неверна";
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Ошибка: ");
                }
                policy.Disconnect();
            }
            manager.ReleaseContext();
        }
コード例 #19
0
        public async Task <IActionResult> UpdateOwner(OwnerInformation ownerInformation)
        {
            await _service.UpdateOwner(ownerInformation);

            return(Ok());
        }
コード例 #20
0
ファイル: CreateDataFile.cs プロジェクト: Samojlov/OMSReader
        public static void GetData(string args = "")
        {
            PCSCReadersManager manager = new PCSCReadersManager();

            try
            {
                manager.EstablishContext(SmartCard.PCSC.READERSCONTEXTSCOPE.SCOPE_USER);
                if (args != "")
                {
                    ReaderName = args;
                }
                else
                {
                    var list = manager.OfType <ISCard>().ToList();

                    if (list.Count > 0)
                    {
                        ReaderName = list[0].ReaderName;
                    }
                    else
                    {
                        ContentFile += "Не найдены ридеры!";
                    }
                }

                if (manager.OfType <ISCard>().Select(s => s.ReaderName).ToList().Contains(ReaderName))
                {
                    //Получение объекта ридера
                    ISCard card = manager[ReaderName];
                    //Создание объекта для работы с картой полиса ОМС
                    PolicySmartcardBase policy = new PolicySmartcardBase(card);
                    //Подключение к карте полиса ОМС
                    policy.Connect();
                    //Чтение информации о владельце полиса ОМС
                    OwnerInformation owner_info = policy.GetOwnerInformation();
                    if (owner_info != null)
                    {
                        printf("Информация о владельце:");
                        printf("{0} = {1}", "Фамилия".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.Identity_1, "Отсутствует"));
                        printf("{0} = {1}", "Имя".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.Identity_2, "Отсутствует"));
                        printf("{0} = {1}", "Отчество".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.Identity_3, "Отсутствует"));
                        printf("{0} = {1}", "Пол".PadRight(35, ' '), owner_info.Sex == 1 ? "Мужской" : owner_info.Sex == 2 ? "Женский" : "Неизвестно");
                        printf("{0} = {1}", "Дата рождения".PadRight(35, ' '), MainForm.FormatPolicyDate(owner_info.BirthDate, "Отсутствует"));
                        printf("{0} = {1}", "Место рождения".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.BirthPlace, "Отсутствует"));

                        if (owner_info.Citizenship != null)
                        {
                            printf("Гражданство:");
                            printf("{0} = {1}", "Код страны".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.Citizenship.CoutryCode, "Отсутствует"));
                            printf("{0} = {1}", "Кириллическое название".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.Citizenship.CoutryCyrillicName, "Отсутствует"));
                        }
                        else
                        {
                            printf("{0} = {1}", "Гражданство".PadRight(35, ' '), "Отсутствует");
                        }

                        printf("Информация о полисе:");
                        printf("{0} = {1:D16}", "Номер полиса".PadRight(35, ' '), owner_info.PolicyNumber);
                        printf("{0} = {1}", "Дата выпуска".PadRight(35, ' '), MainForm.FormatPolicyDate(owner_info.ExpireDate, "Отсутствует"));
                        printf("{0} = {1}", "Срок действия".PadRight(35, ' '), MainForm.FormatPolicyDate(owner_info.ExpireDate, "Не ограничено"));
                        printf("{0} = {1}", "СНИЛС".PadRight(35, ' '), MainForm.FormatPolicyText(owner_info.SNILS, "Отсутствует"));
                        //printf("Чтение атрибутов безопасности карты полиса ОМС");
                        //SecurityInformation SOD = policy.GetSecurityInformation();
                        //printf("{0} = {1}", "Статус ЭЦП".PadRight(35, ' '), owner_info.VerifyEDS(SOD) ? "Верна" : "Неверна");
                    }
                    else
                    {
                        printf("Данные о владельце отсутствуют на карте!");
                    }

                    SMOInformation smo = policy.GetCurrentSMOInformation();
                    if (smo != null)
                    {
                        printf("Данные страхового приложения:");
                        printf("{0} = {1}", "ОГРН".PadRight(35, ' '), smo.OGRN);
                        printf("{0} = {1}", "ОКАТО".PadRight(35, ' '), smo.OKATO);
                        printf("{0} = {1}", "Дата начала страхования".PadRight(35, ' '), MainForm.FormatPolicyDate(smo.InsuranceStartDate, "Отсутствует"));
                        printf("{0} = {1}", "Окончание срока действия".PadRight(35, ' '), MainForm.FormatPolicyDate(smo.InsuranceExpireDate, "Не ограничено"));
                        if (smo.EDS != null)
                        {
                            printf("Данные ЭЦП");
                            printf("{0} = {1}", "Сертификат".PadRight(35, ' '), new X509Certificate2(smo.EDS.Certificate).Subject);
                            printf("{0} = {1}", "ЭЦП".PadRight(35, ' '), smo.EDS.Signature.ToHexString());
                            //printf("{0} = {1}", "Статус ЭЦП".PadRight(35, ' '), smo.VerifyEDS() == true ? "Верна" : "Неверна");
                        }
                        else
                        {
                            printf("{0} = {1}", "Данные ЭЦП".PadRight(35, ' '), "Отсутствуют");
                        }
                    }
                    else
                    {
                        printf("Данные о смо отсутствуют на карте!");
                    }

                    CardID cid = policy.GetCardID();
                    ICCID  ccd = policy.GetICCD();
                    if (cid != null)
                    {
                        printf("Идентификационные данные карты:");
                        printf("{0} = {1}", "Серийный номер карты".PadRight(35, ' '), cid.SerialNumber.ToHexString());
                        printf("{0} = {1}", "Тип карты".PadRight(35, ' '), cid.CardType);
                        printf("{0} = {1}", "Версия".PadRight(35, ' '), cid.CardVersion);
                        printf("{0} = {1}", "Идентификатор учреждения".PadRight(35, ' '), cid.InstitutionID.ToHexString());
                        printf("{0} = {1}", "Дополнительные сведения о карте".PadRight(35, ' '), cid.AdditionalInfo.ToHexString());
                    }
                    else
                    {
                        printf("Идентификационные данные отсутствуют на карте!");
                    }

                    if (ccd != null)
                    {
                        printf("Информация о микросхеме от производителя:");
                        printf("{0} = {1}", "Код производителя карты".PadRight(35, ' '), ccd.IssuerCode);
                        printf("{0} = {1}", "Данные производителя карты".PadRight(35, ' '), ccd.IssuerData.ToHexString());
                    }
                    else
                    {
                        printf("Информация о микросхеме от производителя отсутствует на карте!");
                    }
                    //Отключение от карты полиса ОМС
                    policy.Disconnect();
                    //Отключение от смарт-карт API
                    manager.ReleaseContext();
                }
                else
                {
                    printf("Устройство чтения смарт-карт с именем [{0}] не найдено в системе.");
                    manager.ReleaseContext();
                }
            }
            catch (Exception exception)
            {
                ContentFile += "Ошибка получения списка ридеров: " + exception.Message;
            }

            StreamWriter wf;

            wf = new StreamWriter("infofile.txt", false, Encoding.GetEncoding(1251));
            wf.Write(ContentFile);
            wf.Close();
        }