/// <summary>
        /// Inserts hyperlinks into the specified row.
        /// </summary>
        /// <param name="ws">The target excel worksheet.</param>
        /// <param name="dt"><see cref="DataTable"/> containing output data.</param>
        /// <param name="doc">The target document.</param>
        /// <param name="row">The target row.</param>
        protected void insertRowLinks(ExcelWorksheet ws, DataTable dt, Document doc, int row)
        {
            foreach (HyperLinkInfo link in links)
            {
                Representative rep = doc.Representatives
                                     .FirstOrDefault(r => r.Type.Equals(link.GetFileType()));

                if (rep != null)
                {
                    string fieldName = (String.IsNullOrWhiteSpace(link.GetDisplayText()))
                        ? dt.Columns[link.GetColumnIndex()].ColumnName
                        : link.GetDisplayText();
                    int    col       = dt.Columns.IndexOf(dt.Columns[fieldName]);
                    string linkValue = rep.Files.First().Value;

                    Regex regex = new Regex(ROOT_REGEX);
                    Match match = regex.Match(linkValue);

                    if (!match.Success)
                    {
                        linkValue = ".\\" + linkValue.TrimStart('\\');
                    }

                    string displayText = (!String.IsNullOrWhiteSpace(link.GetDisplayText()))
                        ? link.GetDisplayText()
                        : (String.IsNullOrWhiteSpace(dt.Rows[row][col].ToString()))
                            ? "Link"
                            : dt.Rows[row][col].ToString();
                    string cellValue = String.Format("HYPERLINK(\"{0}\", \"{1}\")", linkValue, displayText);
                    ws.Cells[row + 2, col + 1].Formula = cellValue;
                    ws.Cells[row + 2, col + 1].Style.Font.Color.SetColor(Color.Blue);
                }
            }
        }
        public void Should_map_representative()
        {
            var caseRole    = new CaseRole(1, "Claimant");
            var hearingRole = new HearingRole(2, "Representative")
            {
                UserRole = new UserRole(6, "Representative")
            };

            var person         = new PersonBuilder().WithOrganisation().Build();
            var representative = new Representative(person, hearingRole, caseRole)
            {
                Reference   = "HUHIUHFIH",
                Representee = "Mr A. Daijif",
                DisplayName = "I. Vidual",
                CreatedBy   = "*****@*****.**"
            };

            representative.SetProtected(nameof(representative.CaseRole), caseRole);
            representative.SetProtected(nameof(representative.HearingRole), hearingRole);

            var response = _mapper.MapParticipantToResponse(representative);

            AssertParticipantCommonDetails(response, representative, caseRole, hearingRole);
            AssertRepresentativeResponse(response, representative);
            AssertAddressMapping(response, null);
            response.Organisation.Should().Be(person.Organisation.Name);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var obj = JObject.Load(reader);

            Representative representative;

            if ((obj["discriminator"] != null && obj["discriminator"].ToString() == "RepresentativePerson") ||
                (obj["Discriminator"] != null && obj["Discriminator"].ToString() == "RepresentativePerson"))
            {
                representative = new RepresentativePerson();
            }
            else if ((obj["discriminator"] != null && obj["discriminator"].ToString() == "RepresentativeCompany") ||
                     (obj["Discriminator"] != null && obj["Discriminator"].ToString() == "RepresentativeCompany"))
            {
                representative = new RepresentativeCompany();
            }
            else
            {
                representative = new Representative();
            }

            serializer.Populate(obj.CreateReader(), representative);

            return(representative);
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("FullName,Birthday,Rating,Avatar,Orphanage")]
                                                 Representative representative, int id, IFormFile file)
        {
            await ImageHelper.SetAvatar(representative, file, "wwwroot\\representatives");

            if (ModelState.IsValid)
            {
                var orphanage = await _unitOfWorkAsync.Orphanages.GetById(id);

                representative.Orphanage = orphanage;

                await _unitOfWorkAsync.Representatives.Create(representative);

                await _unitOfWorkAsync.Representatives.SaveChangesAsync();

                var user = await GetCurrentUserAsync();

                user.PersonID   = representative.ID;
                user.PersonType = Models.Identity.PersonType.Representative;
                await _unitOfWorkAsync.UserManager.UpdateAsync(user);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(representative));
        }
Beispiel #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PhoneNumber,Email,CustomerId")] Representative representative)
        {
            if (id != representative.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(representative);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RepresentativeExists(representative.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Address", representative.CustomerId);
            return(View(representative));
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepresentativeEx"/> class.
        /// </summary>
        /// <param name="representative">
        /// The representative.
        /// </param>
        public RepresentativeEx(Representative representative)
        {
            if (representative != null)
            {
                FirstName      = representative.FirstName;
                LastName       = representative.LastName;
                MiddleName     = representative.MiddleName;
                HomePhone      = representative.HomePhone;
                WorkPhone      = representative.WorkPhone;
                RelationTypeId = representative.RelationType != null ? representative.RelationType.Id : -1;
                if (representative.Document != null)
                {
                    IssuingAuthority = representative.Document.IssuingAuthority;
                    if (representative.Document.DateIssue != null)
                    {
                        DateIssue = representative.Document.DateIssue.Value.ToString("dd.MM.yyyy");
                    }

                    if (representative.Document.DateExp != null)
                    {
                        DateExp = representative.Document.DateExp.Value.ToString("dd.MM.yyyy");
                    }
                }
            }
        }
        public IActionResult Save([FromBody] Representative newRep)
        {
            Context.Representatives.Add(newRep);
            Context.SaveChanges();

            return(Json(newRep));
        }
Beispiel #8
0
        /// <summary>
        /// Builds a text <see cref="Representative"/> from an image load file.
        /// </summary>
        /// <param name="pages">The parsed lines from a load file which span all pages for a <see cref="Document"/>.</param>
        /// <param name="assembler">A function that assembles the parsed line from a page into a image key and image path.</param>
        /// <returns>Returns a text <see cref="Representative"/>.</returns>
        public Representative Build(IEnumerable <string[]> pages, Func <string[], KeyValuePair <string, string> > assembler)
        {
            SortedDictionary <string, string> files = new SortedDictionary <string, string>();
            List <string[]> records = new List <string[]>();

            if (FileLevel == TextLevel.Page)
            {
                foreach (string[] page in pages)
                {
                    records.Add(page);
                }
            }
            else if (FileLevel == TextLevel.Doc)
            {
                records.Add(pages.First());
            }

            foreach (string[] record in records)
            {
                var    result = assembler.Invoke(record);
                string key    = result.Key;
                string path   = GetTextPathFromImagePath(result.Value);
                files.Add(key, path);
            }

            Representative text = (files.Count > 0)
                ? new Representative(Representative.FileType.Text, files)
                : null;

            return(text);
        }
        public async Task <IHttpActionResult> PutRepresentative(int id, Representative representative)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != representative.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RepresentativeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 private void okButton_Click(object sender, EventArgs e)
 {
     // Checks wether fields are empty.
     if (string.IsNullOrWhiteSpace(companyNameTextbox.Text) ||
         string.IsNullOrWhiteSpace(postalcodeTextbox.Text) ||
         string.IsNullOrWhiteSpace(locationTextbox.Text) ||
         string.IsNullOrWhiteSpace(phonenumberTextbox.Text) ||
         string.IsNullOrWhiteSpace(emailTextbox.Text) ||
         string.IsNullOrWhiteSpace(kvkNumberTextbox.Text) ||
         string.IsNullOrWhiteSpace(ibanTextbox.Text))
     {
         MessageBox.Show("Vul alstublieft alle velden in.", "Foutmelding",
                         MessageBoxButtons.OK);
     }
     else
     {
         // Makes nw representative using the given data.
         representative = new Representative(
             companyNameTextbox.Text,
             postalcodeTextbox.Text,
             locationTextbox.Text,
             phonenumberTextbox.Text,
             emailTextbox.Text,
             kvkNumberTextbox.Text,
             ibanTextbox.Text
             );
     }
     Close();
 }
Beispiel #11
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            Representative current         = reps[position];
            View           rootView        = convertView ?? activity.LayoutInflater.Inflate(Resource.Layout.ListViewItemReps, parent, false);
            TextView       previewTextView = rootView.FindViewById <TextView>(Resource.Id.textView1);
            ImageView      photo           = rootView.FindViewById <ImageView>(Resource.Id.thumbnail);
            Bitmap         imageBitmap     = null;
            var            imageBytes      = current.PhotoBytes;
            var            options         = new BitmapFactory.Options();

            if (imageBytes != null && imageBytes.Length > 0)
            {
                if (imageBytes.Length > 100000)
                {
                    options.InSampleSize = 20;
                }

                if (imageBytes != null && imageBytes.Length > 0)
                {
                    imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length, options);
                }
                photo.SetImageBitmap(imageBitmap);
            }
            else
            {
                photo.SetImageDrawable(activity.GetDrawable(Resource.Drawable.elected));
            }
            previewTextView.Text = current.OfficeName + "\n" + current.Name + "(" + current.Party + ")";
            return(rootView);
        }
Beispiel #12
0
        private void CheckRepresentative(Models.FinanceData financeData, CustomContext context)
        {
            Models.PersonalData personalData   = financeData.Enrollment.PersonalData;
            Representative      representative = financeData.Representative;

            if (!string.IsNullOrEmpty(personalData.BirthDate) && GetAge(personalData.BirthDate) > 18)
            {
                bool isDiff = false;

                if (representative is RepresentativePerson)
                {
                    isDiff = representative.Name != personalData.RealName ? true : isDiff;
                    isDiff = representative.StreetAddress != personalData.StreetAddress ? true : isDiff;
                    isDiff = representative.Neighborhood != personalData.Neighborhood ? true : isDiff;
                    isDiff = representative.PhoneNumber != personalData.PhoneNumber ? true : isDiff;
                    isDiff = representative.Landline != personalData.Landline ? true : isDiff;
                    isDiff = representative.Email != personalData.Email ? true : isDiff;
                    isDiff = representative.CityId != personalData.CityId ? true : isDiff;
                    isDiff = representative.StateId != personalData.StateId ? true : isDiff;
                    isDiff = ((RepresentativePerson)representative).Cpf != personalData.CPF ? true : isDiff;
                }

                if (isDiff)
                {
                    context.AddFailure("Dados do responsável não são os mesmos dos dados pessoais.");
                }
            }
        }
        /// <summary>
        /// Gets the value of the code end flag for the target document and image.
        /// </summary>
        /// <param name="docIndex">The index of the current document in the collection being exported.</param>
        /// <param name="imageIndex">The index of the current image in the current document.</param>
        /// <param name="settings">The XREF export settings.</param>
        /// <returns>Returns true if this is the last document and we are waiting for a code end flag.
        /// Returns true if the next document will have a code start flag. Otherwise false is returned.</returns>
        protected bool getCodeEndFlag(int docIndex, int imageIndex, Switch trigger)
        {
            bool           result      = false;
            Document       doc         = this.docs[docIndex];
            Document       previousDoc = getPreviousDoc(docIndex);
            Document       nextDoc     = getNextDoc(docIndex);
            Representative imageRep    = doc.Representatives
                                         .Where(r => r.Type.Equals(Representative.FileType.Image))
                                         .FirstOrDefault();
            string   nextImageKey = getNextImageKey(imageIndex, docIndex);
            Document nextImageDoc = (String.IsNullOrEmpty(nextImageKey))
                ? null : (imageRep.Files.ContainsKey(nextImageKey)) ? doc : nextDoc;
            Document nextImagePreviousDoc = (String.IsNullOrEmpty(nextImageKey))
                ? null : (imageRep.Files.ContainsKey(nextImageKey)) ? previousDoc : doc;

            if (nextDoc == null && this.waitingForCodeEnd)
            {
                result = true;
            }
            else if (nextDoc == null && !this.waitingForCodeEnd)
            {
                result = false;
            }
            else
            {
                result = getCodeStartFlag(nextImageDoc, nextImagePreviousDoc, trigger);
            }

            return(result);
        }
        /// <summary>
        /// Gets the value of the group end flag for the target document and image.
        /// </summary>
        /// <param name="docIndex">The index of the current document in the collection being exported.</param>
        /// <param name="imageIndex">The index of the current image in the current document.</param>
        /// <param name="settings">The XREF export settings.</param>
        /// <returns>Returns true if this is the last document and we are waiting for a group end flag.
        /// Returns true if the next document has a group start flag. Otherwise false is returned.</returns>
        protected bool getGroupEndFlag(int docIndex, int imageIndex, Switch trigger)
        {
            bool           result       = false;
            string         nextImageKey = getNextImageKey(imageIndex, docIndex);
            Document       doc          = this.docs[docIndex];
            Document       previousDoc  = getPreviousDoc(docIndex);
            Document       nextDoc      = getNextDoc(docIndex);
            Representative imageRep     = doc.Representatives
                                          .Where(r => r.Type.Equals(Representative.FileType.Image))
                                          .FirstOrDefault();
            int nextImageDocIndex = (nextImageKey != null && imageRep.Files.ContainsKey(nextImageKey))
                ? docIndex : docIndex++;

            if (nextDoc == null && this.waitingForGroupEnd)
            {
                result = true;
            }
            else if (nextDoc == null && !this.waitingForGroupEnd)
            {
                result = false;
            }
            else
            {
                result = getGroupStartFlag(nextImageKey, nextImageDocIndex, trigger);
            }

            return(result);
        }
        /// <summary>
        /// Modifies the type and path or a representative.
        /// </summary>
        /// <param name="doc">The document to be modified.</param>
        public override void Transform(Document doc)
        {
            if (base.hasEdit(doc))
            {
                HashSet <Representative> representatives = new HashSet <Representative>();

                foreach (Representative rep in doc.Representatives)
                {
                    if (rep.Type == targetType)
                    {
                        Representative.FileType updatedType = (newType != null)
                            ? (Representative.FileType)newType
                            : rep.Type;
                        SortedDictionary <string, string> updatedFiles = new SortedDictionary <string, string>();

                        foreach (var file in rep.Files)
                        {
                            updatedFiles.Add(file.Key, base.Replace(file.Value));
                        }

                        Representative newRep = new Representative(updatedType, updatedFiles);
                        representatives.Add(newRep);
                    }
                    else
                    {
                        representatives.Add(rep);
                    }
                }

                doc.SetLinkedFiles(representatives);
            }
        }
Beispiel #16
0
 // Set information for PDF.
 public void SetInfo(Customer cus, Representative rep, string number, Room room)
 {
     customer       = cus;
     representative = rep;
     invoiceNumber  = number;
     this.room      = room;
 }
Beispiel #17
0
        /// <summary>
        /// Builds a <see cref="Document"/> from an OPT file.
        /// </summary>
        /// <param name="pages">The parsed lines for a document.</param>
        /// <returns>Returns a <see cref="Document"/>.</returns>
        public Document BuildDocument(IEnumerable <string[]> pages)
        {
            // get document properties
            string[] pageOne    = pages.First();
            string   key        = pageOne[IMAGE_KEY_INDEX];
            string   vol        = pageOne[VOLUME_NAME_INDEX];
            string   box        = pageOne[BOX_BREAK_INDEX];
            string   dir        = pageOne[FOLDER_BREAK_INDEX];
            int      pagesCount = pages.Count();
            // set document properties
            Dictionary <string, string> metadata = new Dictionary <string, string>();

            metadata.Add(IMAGE_KEY_FIELD, key);
            metadata.Add(VOLUME_NAME_FIELD, vol);
            metadata.Add(PAGE_COUNT_FIELD, pagesCount.ToString());
            //metadata.Add(BOX_BREAK_FIELD, box); // extraneous meta
            //metadata.Add(FOLDER_BREAK_FIELD, dir); // extraneous meta
            // build the representatives
            Representative           imageRep = getImageRepresentative(pages);
            Representative           textRep  = getTextRepresentative(pages);
            HashSet <Representative> reps     = new HashSet <Representative>();

            reps.Add(imageRep);
            reps.Add(textRep);
            reps.Remove(null);
            // no family relationships in an opt
            Document           parent   = null;
            HashSet <Document> children = null;

            return(new Document(key, parent, children, metadata, reps));
        }
Beispiel #18
0
        private Representative MapPersonDataToRep(PersonData per_data, EntityPersonData emp_data)
        {
            Representative rep = MapPersonData <Representative>(per_data);

            _pers_es.Map(emp_data, rep);
            return(rep);
        }
    public static RatingMemberInfo Get(int userId)
    {
        if (AppSettings.Side == ScriptSide.Client)
        {
            Dictionary <int, RatingMemberInfo> dictionary;
            if (HttpContext.Current.Cache[Name] != null)
            {
                dictionary = (Dictionary <int, RatingMemberInfo>)HttpContext.Current.Cache[Name];
            }
            else
            {
                dictionary = new Dictionary <int, RatingMemberInfo>();
            }

            if (dictionary.ContainsKey(userId))
            {
                return(dictionary[userId]);
            }
            else
            {
                dictionary[userId] = Representative.LoadNewUserData(userId);
                HttpContext.Current.Cache.Insert(Name, dictionary, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration,
                                                 CacheItemPriority.Normal, null);

                return(dictionary[userId]);
            }
        }
        else
        {
            return(Representative.LoadNewUserData(userId));
        }
    }
Beispiel #20
0
        public InvoiceForm(Room room, MainView mv)
        {
            if (mv.mm.customer != null)
            {
                this.customer = mv.mm.customer;
                GetCustomernr();
            }
            InitializeComponent();
            this.room = room;

            using (var mc = new MyContext())
            {
                // getting used subtheme
                this.selected = DatabaseController.getLastSubTheme();
            }

            // Sets date and gives a unique InvoiceLabel.
            dateInvoiceDateLabel.Text  = DateTime.Now.ToShortDateString();
            intInvoiceNumberLabel.Text = (DatabaseController.invoiceList.Count + 1).ToString();
            this.representative        = DatabaseController.representativeList.First();
            ic = new InvoiceController(invoiceListPanel1, room.productList);

            ic.FillDisplayedProductList();
            intInvoiceTotalPriceLabelprijsLabel.Text = ic.totalPrice.ToString();
        }
Beispiel #21
0
        /// <summary>
        /// Gets a documents image representative from an LFP file.
        /// </summary>
        /// <param name="pageRecords">A list of page records from an LFP file for a document.</param>
        /// <returns>Returns an image <see cref="Representative"/>.</returns>
        protected Representative getImageRepresentative(IEnumerable <string[]> pageRecords)
        {
            Representative imageRep = null;

            if (pageRecords.Count() > 0)
            {
                SortedDictionary <string, string> imageFiles = new SortedDictionary <string, string>();
                // get image files
                foreach (string[] page in pageRecords)
                {
                    int offset = int.Parse(page[IMAGE_OFFSET_INDEX]);
                    // exclude multi-page image references
                    if (offset == 0 || offset == 1)
                    {
                        string imageKey = page[KEY_INDEX];
                        string filePath = String.IsNullOrEmpty(pathPrefix)
                            ? page[IMAGE_FILE_PATH_INDEX]
                            : Path.Combine(
                            pathPrefix,
                            page[IMAGE_FILE_PATH_INDEX].TrimStart(FILE_PATH_DELIM));
                        filePath = Path.Combine(filePath, page[IMAGE_FILE_NAME_INDEX]);
                        imageFiles.Add(imageKey, filePath);
                    }
                }

                imageRep = new Representative(Representative.FileType.Image, imageFiles);
            }

            return(imageRep);
        }
Beispiel #22
0
        /// <summary>
        /// The get assignee.
        /// </summary>
        /// <param name="representative">
        /// The representative.
        /// </param>
        /// <returns>
        /// The <see cref="AssigneeType"/>.
        /// </returns>
        protected virtual AssigneeType GetAssignee(Representative representative)
        {
            if (representative == null)
            {
                return(null);
            }

            var conceptManager  = ObjectFactory.GetInstance <IConceptCacheManager>();
            var documentManager = ObjectFactory.GetInstance <IDocumentManager>();
            var pr = new AssigneeType();

            pr.FAM        = representative.LastName;
            pr.IM         = representative.FirstName;
            pr.OT         = representative.MiddleName;
            pr.PHONE      = representative.HomePhone;
            pr.PHONE_WORK = representative.WorkPhone;
            if (representative.RelationType != null)
            {
                pr.RELATION = conceptManager.Unproxy(representative.RelationType).Code;
            }

            if (representative.Document != null)
            {
                pr.DOC = GetDocument(documentManager.GetById(representative.Document.Id), DocumentCategory.Udl);
            }

            return(pr);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!ValidateMandatoryFields())
            {
                return;
            }

            var existingRepresentative = uow.Repository.GetAll().Where(u => u.RepresentativeCode == txtRepresentativeCode.Text.Trim()).FirstOrDefault();

            if (existingRepresentative != null)
            {
                CommonMessageHelper.DataAlreadyExist(txtRepresentativeCode.Text.Trim());
            }
            else
            {
                var representativeToAdd = new Representative
                {
                    RepresentativeCode = txtRepresentativeCode.Text.Trim(),
                    Description        = txtRepresentative.Text.Trim(),

                    // Audit Fields
                    CreatedBy  = Properties.Settings.Default.CurrentUserId,
                    CreatedAt  = DateTime.Now,
                    ModifiedBy = Properties.Settings.Default.CurrentUserId,
                    ModifiedAt = DateTime.Now
                };
                uow.Repository.Add(representativeToAdd);
                uow.Commit();
                btnReload.PerformClick();
                CommonMessageHelper.DataSavedSuccessfully();
            }
        }
        public List <Representative> ProcessGoogleResult(string result)
        {
            List <Representative> reps = new List <Representative>();

            var obj = JsonConvert.DeserializeObject <JObject>(result);
            int i   = 0;

            foreach (var record in obj["offices"])
            {
                var party    = obj["officials"][i]["party"] ?? "None";
                var phone    = obj["officials"][i]["phones"] != null ? obj["officials"][i]["phones"][0] ?? "-" : "-";
                var email    = obj["officials"][i]["emails"] != null ? obj["officials"][i]["emails"][0] ?? "-" : "-";
                var imageUrl = obj["officials"][i]["photoUrl"] ?? "-";

                Representative rep = new Representative()
                {
                    Name        = obj["officials"][i]["name"].ToString(),
                    Office      = obj["offices"][i]["name"].ToString(),
                    Party       = party.ToString(),
                    PhoneNumber = phone.ToString(),
                    Email       = email.ToString(),
                    ImageUrl    = imageUrl.ToString()
                };
                i++;
                reps.Add(rep);
            }

            return(reps);
        }
Beispiel #25
0
        /// <summary>
        /// Переносит данные из элементов на форме в объект
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// </summary>
        /// <param name="setCurrentStatement">
        /// Обновлять ли свойство CurrentStatement после присвоения заявлению данных из дизайна
        /// </param>
        public override void MoveDataFromGui2Object(ref Statement statement, bool setCurrentStatement = true)
        {
            if (statement.ModeFiling.Id == ModeFiling.ModeFiling2)
            {
                Representative representative = statement.Representative ?? new Representative();
                //Фамилия
                representative.LastName = tbLastName.Text;
                //Имя
                representative.FirstName = tbFirstName.Text;
                //Отчество
                representative.MiddleName = tbMiddleName.Text;
                //Отношение к застрахованному лицу
                int relationType = Int32.Parse(ddlRelationType.SelectedValue);
                if (relationType >= 0)
                {
                    representative.RelationType = regulatoryService.GetConcept(relationType);
                }

                //Документ УДЛ
                Document document = representative.Document ?? new Document();
                //Вид документа УДЛ
                if (documentUDL.DocumentType >= 0)
                {
                    document.DocumentType = regulatoryService.GetConcept(documentUDL.DocumentType);
                }
                //Серия
                document.Series = documentUDL.DocumentSeries;
                //Номер
                document.Number = documentUDL.DocumentNumber;
                //Номер
                document.IssuingAuthority = documentUDL.DocumentIssuingAuthority;

                //Дата выдачи
                document.DateIssue = documentUDL.DocumentIssueDate;
                document.DateExp   = documentUDL.DocumentExpDate;

                //присвоение документа
                representative.Document = document;

                //Телефон домашний
                representative.HomePhone = tbHomePhone.Text;
                //Телефон рабочий
                representative.WorkPhone = tbWorkPhone.Text;

                statement.Representative = representative;
            }
            else
            {
                statement.Representative = null;
            }

            statementService.TrimStatementData(statement);

            //сохранение изменений в сессию
            if (setCurrentStatement)
            {
                CurrentStatement = statement;
            }
        }
 public void UpdateRepresentative(Representative Representative)
 {
     using (var db = _unitOfWorkFactory.GetUnitOfWork())
     {
         db.Representatives.Update(Representative);
         db.SaveChanges();
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Representative representative = db.Representatives.Find(id);

            db.Representatives.Remove(representative);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #28
0
        public RepProfilePage(Representative local)
        {
            InitializeComponent();
            UpdateThemeColors();
            CurrentRep = local;

            //Load Data
            NameLBL.Text  = CurrentRep.FullName;
            TitleLBL.Text = CurrentRep.OfficeName;
            PartyLBL.Text = CurrentRep.Party.ToString();

            //Check For Profile Image
            if (CurrentRep.ImageUrl != null)
            {
                ProfilePhotoIMG.Source = CurrentRep.ImageUrl;
            }
            else
            {
                //Disable The Item
                ImageLayout.IsVisible     = false;
                ProfilePhotoIMG.IsVisible = false;
                TitleLayout.Children.Add(NameLBL);
                TitleLayout.Children.Add(TitleLBL);
            }

            //Check For Phone Number
            if (!string.IsNullOrEmpty(CurrentRep.PhoneNumber))
            {
                PhoneLBL.Text = CurrentRep.PhoneNumber;
            }
            else
            {
                //Disable The Item
                PhoneLBL.IsVisible     = false;
                PhoneHeader.IsVisible  = false;
                PhoneCallBTN.IsEnabled = false;
            }

            //Check For Website
            if (CurrentRep.Website != null)
            {
                WebsiteLBL.Text = CurrentRep.Website.ToString();
            }
            else
            {
                //Disable The Item
                WebsiteBTN.IsEnabled    = false;
                WebsiteLBL.IsVisible    = false;
                WebsiteHeader.IsVisible = false;
            }

            //Check For Email
            if (string.IsNullOrEmpty(CurrentRep.PrimaryEmail))
            {
                //Disable The Item
                EmailBTN.IsEnabled = false;
            }
        }
Beispiel #29
0
 public MonthlyContractPrinter(string templatePath, Contract contract, Representative representative, string startDate, string endDate)
 {
     _contract       = contract;
     _representative = representative;
     _startDate      = startDate;
     _endDate        = endDate;
     _templatePath   = templatePath;
     _fieldsValues   = PopulateFieldsInfo();
 }
Beispiel #30
0
    protected void DepositViaRepresentativeButton_Click(object sender, EventArgs e)
    {
        ErrorMessagePanel.Visible = false;
        SuccMessagePanel.Visible  = false;

        string amount = Request.Form["price"].ToString();
        Money  Amount;

        try
        {
            Amount = Money.Parse(amount).FromMulticurrency();

            //Anti-Injection Fix
            if (Amount <= new Money(0))
            {
                throw new MsgException(L1.ERROR);
            }

            if (Amount < AppSettings.Payments.MinimumTransferAmount)
            {
                throw new MsgException(U3000.ITSLOWERTHANMINIMUM);
            }

            if (string.IsNullOrEmpty(RepresentativeMessage.Text) || String.IsNullOrWhiteSpace(RepresentativeMessage.Text))
            {
                throw new MsgException(L1.REQ_TEXT);
            }

            string Message = InputChecker.HtmlEncode(RepresentativeMessage.Text, RepresentativeMessage.MaxLength, U5004.MESSAGE);

            var SelectedRepresentative = new Representative(Convert.ToInt32(AvaibleRepresentativeList.SelectedValue));

            if (ConversationMessage.CheckIfThisUserHavePendingActions(user.Id))
            {
                throw new MsgException(U6010.YOUHAVEPENDINGACTION);
            }

            if (Amount > new Member(SelectedRepresentative.UserId).CashBalance)
            {
                throw new MsgException(U6010.REPRESENTATIVENOFUNDS);
            }

            RepresentativesTransferManager representativesTransferManager = new RepresentativesTransferManager(Member.CurrentId, SelectedRepresentative.UserId);
            representativesTransferManager.InvokeDeposit(Amount, Message);

            Response.Redirect("~/user/network/messenger.aspx");
        }
        catch (MsgException ex)
        {
            ShowErrorMessage(ex.Message);
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
            ShowErrorMessage(ex.Message);
        }
    }
    private Representative readRep(string dataType, string dataText, string fileName, StreamReader reader)
    {
        if (dataText == "<{>") {
            // Start of block
            Representative rep = new Representative();

            string line = reader.ReadLine().Trim ();
            do {
                string[] lineParts;
                //Split category name from data
                lineParts = line.Split(":".ToCharArray(), 2);

                //Remove any extra whitespace from parts & set descriptive variables
                string newDataType = gameManager.LanguageMgr.StringToDataType(lineParts[0].Trim ());
                string newDataText = lineParts[1].Trim ();

                if (newDataType == "Name") {
                    rep.Name = readTextLine (newDataType, newDataText, fileName);
                } else if (newDataType == "Votes") {
                    rep.Votes = readIntLine (newDataType, newDataText, fileName);
                } else if (newDataType == "Types") {
                    rep.RepTypes = readRTypesBlock (newDataType, newDataText, fileName, reader);
                } else if (newDataType == "Text") {
                    rep.Text = readTextLine (newDataType, newDataText, fileName);
                } else if (newDataType == "ID") {
                    rep.Id = readTextLine (newDataType, newDataText, fileName);
                }
                line = reader.ReadLine().Trim ();

            } while (line != "<}>");
            // End of block

            if (rep.Id == default(string)) {
                rep.Id = rep.Name;
            }

            return rep;
        } else {
            throw new System.Exception(string.Format("Error reading file {0}:: got \"{1}\" should be <{>", fileName, dataText));
        }
    }
Beispiel #32
0
 public Representative getRepClassByUserID(string ID)
 {
     Representative representative = new Representative();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM representative WHERE log_staff='" + ID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         representative.ID = reader["ID"].ToString();
         representative.agent_code = reader["agent_code"].ToString();
         representative.xname = reader["xname"].ToString();
         representative.individual_id_type = reader["individual_id_type"].ToString();
         representative.individual_id_number = reader["individual_id_number"].ToString();
         representative.nationality = reader["nationality"].ToString();
         representative.addressID = reader["addressID"].ToString();
         representative.log_staff = reader["log_staff"].ToString();
         representative.reg_date = reader["reg_date"].ToString();
         representative.visible = reader["visible"].ToString();
     }
     reader.Close();
     return representative;
 }
Beispiel #33
0
 public List<Representative> getRepListByUserID(string ID)
 {
     List<Representative> list = new List<Representative>();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM representative WHERE log_staff='" + ID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         Representative item = new Representative
         {
         ID = reader["ID"].ToString(),
         agent_code = reader["agent_code"].ToString(),
         xname = reader["xname"].ToString(),
         individual_id_type = reader["individual_id_type"].ToString(),
         individual_id_number = reader["individual_id_number"].ToString(),
         nationality = reader["nationality"].ToString(),
         addressID = reader["addressID"].ToString(),
         log_staff = reader["log_staff"].ToString(),
         reg_date = reader["reg_date"].ToString(),
         visible = reader["visible"].ToString()
         };
         list.Add(item);
     }
     reader.Close();
     return list;
 }
Beispiel #34
0
 public string addCurrentTrademark(Applicant c_app, MarkInfo c_mark, AddressService c_aos, Representative c_rep, Address c_app_addy, Address c_rep_addy, string pwallet, string log_officer)
 {
     Stage s = getStageClassByUserID(pwallet);
     string xID = ""; string date = s.reg_date; string year = s.reg_date.Substring(0, 4);
     this.addCurrentApplicant(c_app, c_app_addy, pwallet, date);
     xID = this.addCurrentMark(c_mark, pwallet, date);
     this.updateCurrentMarkReg(xID, c_mark.tm_typeID, year);
     this.addCurrentAos(c_aos, pwallet, date);
     this.addCurrentRepresentative(c_rep, c_rep_addy, pwallet, date);
     this.updatePwalletStatus(pwallet, log_officer);
     return xID;
 }
Beispiel #35
0
 public string addTrademark(Applicant c_app, MarkInfo c_mark, AddressService c_aos, Representative c_rep, Address c_app_addy, Address c_rep_addy, string pwallet, string log_officer)
 {
     string xID = "";
     this.addApplicant(c_app, c_app_addy, pwallet);
     xID = this.addMark(c_mark, pwallet);
     this.updateMarkReg(xID, c_mark.tm_typeID);
     this.addAos(c_aos, pwallet);
     this.addRepresentative(c_rep, c_rep_addy, pwallet);
     this.updatePwalletStatus(pwallet, log_officer);
     return xID;
 }
Beispiel #36
0
 public string addSoloRepresentative(Representative c_rep,string addID, string pwalletID)
 {
     if (c_rep.agent_code == null) { c_rep.agent_code = ""; }
     if (c_rep.xname == null) { c_rep.xname = ""; }
     if (c_rep.nationality == null) { c_rep.nationality = ""; }
     string connectionString = this.Connect();
     string str5 = "";
     SqlConnection connection = new SqlConnection(connectionString);
     SqlCommand command = connection.CreateCommand();
     command.CommandText = "INSERT INTO representative (agent_code,xname,nationality,addressID,log_staff,reg_date,visible) VALUES (@agent_code,@xname,@nationality,@addressID,@log_staff,@reg_date,@visible) SELECT SCOPE_IDENTITY()";
     connection.Open();
     command.Parameters.Add("@agent_code", SqlDbType.VarChar);
     command.Parameters.Add("@xname", SqlDbType.NVarChar);
     command.Parameters.Add("@nationality", SqlDbType.NVarChar, 50);
     command.Parameters.Add("@addressID", SqlDbType.VarChar, 50);
     command.Parameters.Add("@log_staff", SqlDbType.VarChar, 50);
     command.Parameters.Add("@reg_date", SqlDbType.VarChar, 50);
     command.Parameters.Add("@visible", SqlDbType.VarChar, 1);
     command.Parameters["@agent_code"].Value = c_rep.agent_code;
     command.Parameters["@xname"].Value = c_rep.xname;
     command.Parameters["@nationality"].Value = c_rep.nationality;
     command.Parameters["@addressID"].Value = addID;
     command.Parameters["@log_staff"].Value = pwalletID;
     command.Parameters["@reg_date"].Value = c_rep.reg_date;
     command.Parameters["@visible"].Value = c_rep.visible;
     str5 = command.ExecuteScalar().ToString();
     connection.Close();
     return str5;
 }
Beispiel #37
0
        public Representative getRepByUserID(string ID)
        {
            Representative representative = new Representative();
            representative.ID = "";
            representative.agent_code = "";
            representative.xname = "";
            representative.nationality = "";
            representative.country = "";
            representative.state = "";
            representative.address = "";
            representative.xemail = "";
            representative.xmobile = "";
            representative.log_staff = "";
            representative.visible = "";

            SqlConnection connection = new SqlConnection(this.Connect());
            SqlCommand command = new SqlCommand("SELECT * FROM representative WHERE log_staff='" + ID + "' ", connection);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                representative.ID = reader["ID"].ToString();
                representative.agent_code = reader["agent_code"].ToString();
                representative.xname = ConvertTab2Apos(reader["xname"].ToString());
                representative.nationality = reader["nationality"].ToString();
                representative.country = reader["country"].ToString();
                representative.nationality = reader["nationality"].ToString();
                representative.state = reader["state"].ToString();
                representative.address = ConvertTab2Apos(reader["address"].ToString());
                representative.xemail = ConvertTab2Apos(reader["xemail"].ToString());
                representative.xmobile = reader["xmobile"].ToString();
                representative.log_staff = reader["log_staff"].ToString();
                representative.visible = reader["visible"].ToString();

            }
            reader.Close();
            return representative;
        }
Beispiel #38
0
        public string addRepresentative(Representative c_rep)
        {
            string succ = "0";
            string connectionString = this.Connect();
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand command = connection.CreateCommand();
            command.CommandText = "INSERT INTO representative (agent_code,xname,nationality,country,state,address,xemail,xmobile,log_staff,visible) VALUES (@agent_code,@xname,@nationality,@country,@state,@address,@xemail,@xmobile,@log_staff,@visible) SELECT SCOPE_IDENTITY()";
            connection.Open();
            command.Parameters.Add("@agent_code", SqlDbType.VarChar);
            command.Parameters.Add("@xname", SqlDbType.NVarChar);
            command.Parameters.Add("@nationality", SqlDbType.NVarChar, 50);
            command.Parameters.Add("@country", SqlDbType.VarChar, 50);
            command.Parameters.Add("@state", SqlDbType.VarChar, 50);
            command.Parameters.Add("@address", SqlDbType.Text);
            command.Parameters.Add("@xemail", SqlDbType.NVarChar);
            command.Parameters.Add("@xmobile", SqlDbType.VarChar);
            command.Parameters.Add("@log_staff", SqlDbType.VarChar, 50);
            command.Parameters.Add("@visible", SqlDbType.VarChar, 10);

            command.Parameters["@agent_code"].Value = c_rep.agent_code;
            command.Parameters["@xname"].Value = ConvertApos2Tab(c_rep.xname);
            command.Parameters["@nationality"].Value = c_rep.nationality;
            command.Parameters["@country"].Value = c_rep.country;
            command.Parameters["@state"].Value = c_rep.state;
            command.Parameters["@address"].Value = ConvertApos2Tab(c_rep.address);
            command.Parameters["@xemail"].Value = ConvertApos2Tab(c_rep.xemail);
            command.Parameters["@xmobile"].Value = c_rep.xmobile;
            command.Parameters["@log_staff"].Value = c_rep.log_staff;
            command.Parameters["@visible"].Value = c_rep.visible;
            succ = command.ExecuteScalar().ToString();
            connection.Close();
            return succ;
        }
Beispiel #39
0
        public string addNewPatent(List<Applicant> lt_app, List<pt.Priority_info> lt_pri, List<pt.Inventor> lt_inv, PtInfo c_pt, pt.Assignment_info c_assinfo, Representative c_rep)
        {
            string xID = "";

            foreach (Applicant c_app in lt_app)
            {
                if ((c_app.xname != null) && (c_app.xname != ""))
                {
                    this.addApplicant(c_app);
                }
            }
            foreach (Priority_info c_pri in lt_pri)
            {
                if ((c_pri.app_no != null) && (c_pri.app_no != ""))
                {
                    this.addPriority_info(c_pri);
                }
            }
            foreach (Inventor c_inv in lt_inv)
            {
                if ((c_inv.xname != null) && (c_inv.xname != ""))
                {
                    this.addInventor(c_inv);
                }
            }
            if ((c_assinfo.assignee_name != null) && (c_assinfo.assignee_name != "") && (c_assinfo.date_of_assignment != null) && (c_assinfo.date_of_assignment != "") && (c_assinfo.ID != null) && (c_assinfo.ID != ""))
            {
                this.addAssignment_info(c_assinfo);
            }
            xID = this.addPt(c_pt);
            this.updatePtReg(xID, c_pt.xtype);
            this.addRepresentative(c_rep);
            this.updatePwalletStatus(c_pt.log_staff, "0");
            return xID;
        }
Beispiel #40
0
        public string updateRepresentative(Representative x)
        {
            string connectionString = this.Connect();
            string str2 = "";
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand command = connection.CreateCommand();
            command.CommandText = "UPDATE [dbo].[representative] SET [agent_code] ='" + x.agent_code + "',[xname] = '" + ConvertApos2Tab(x.xname) + "',[nationality] = '" + x.nationality + "', ";
            command.CommandText += "  [country] = '" + x.country + "',[state] = '" + x.state + "',[address] = '" + ConvertApos2Tab(x.address) + "' , ";
            command.CommandText += "  [xemail] = '" + ConvertApos2Tab(x.xemail) + "',[xmobile] = '" + x.xmobile + "',[log_staff] = '" + x.log_staff + "' , ";
            command.CommandText += "  [visible] = '" + x.visible + "' WHERE ID ='" + x.ID + "' ";

            connection.Open();
            str2 = command.ExecuteNonQuery().ToString();
            connection.Close();
            return str2;
        }
Beispiel #41
0
 public List<Representative> getRepListByUserID(string validationID)
 {
     List<Representative> list = new List<Representative>();
     new Representative();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM representative WHERE log_staff='" + validationID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         Representative item = new Representative
         {
             ID = reader["ID"].ToString(),
             agent_code = reader["agent_code"].ToString(),
             xname = ConvertTab2Apos(reader["xname"].ToString()),
             nationality = reader["nationality"].ToString(),
             country = reader["country"].ToString(),
             state = reader["state"].ToString(),
             address = ConvertTab2Apos(reader["address"].ToString()),
             xemail = ConvertTab2Apos(reader["xemail"].ToString()),
             xmobile = reader["xmobile"].ToString(),
             log_staff = reader["log_staff"].ToString(),
             visible = reader["visible"].ToString()
         };
         list.Add(item);
     }
     reader.Close();
     return list;
 }