/// <summary> /// Получение данных текущего лица по IpPerson /// </summary> private void InitPerson() { if (PersonId <= 0) { throw new Exception(string.Format("Неправильно переданы параметры! Id = {0}", PersonId)); } PersonObj = new PersonOld(PersonId.ToString()); if (PersonObj == null && PersonObj.Unavailable) { throw new Exception(string.Format("Лицо с кодом #{0} не найдено или не доступно!", PersonId)); } var crd = PersonObj.GetCard(DateTime.Today); if (crd == null) { throw new Exception( string.Format("У лица {0} нет действующих реквизитов на текущую дату!", PersonObj.Name)); } PersonName = crd.NameRus; PersonNameEn = crd.NameLat; PersonKpp = crd.КПП; PersonAddress = crd.АдресЮридический; PersonAddressEn = crd.АдресЮридическийЛат; }
protected override async Task <AuthenticateResult> HandleAuthenticateAsync() { var authorizationHeader = Request.Headers.TryGetValue("Authorization", out var v) ? v : default; Match m; if (authorizationHeader == StringValues.Empty || !(m = Regex.Match(authorizationHeader[0], "Bearer (?<token>.+)")).Success) { return(AuthenticateResult.NoResult()); } var token = m.Groups["token"].Value; PersonProfile?profile = null; if (token.Equals(UserToken, StringComparison.InvariantCultureIgnoreCase)) { profile = await _personProjectionStore.GetProfileAsync(TestScheme, UserPersonId.ToString()); } if (profile == null) { return(AuthenticateResult.NoResult()); } var principal = new ClaimsPrincipal(YayNayIdentity.Create(profile, TestScheme)); var ticket = new AuthenticationTicket(principal, TestScheme); return(AuthenticateResult.Success(ticket)); }
public override int?Save(string action) { var data = new ScheduleDataModel(); data.ScheduleId = ScheduleId; data.Person = PersonId.ToString(); data.ScheduleStateId = ScheduleStateId; data.WorkDate = WorkDate; data.StartTime = StartTime; data.EndTime = EndTime; data.NextWorkDate = NextWorkDate; data.NextWorkTime = NextWorkTime; data.TotalHoursWorked = TotalHoursWorked; data.PlannedHours = PlannedHours; data.FromSearchDate = WorkDate; data.ToSearchDate = WorkDate; if (NextWorkDate < WorkDate) { throw new Exception("Next Work Date should always be greater than Work Date."); } else if (StartTime > EndTime && EndTime != WorkDate) // JIRA #4097 validation { throw new Exception("End Time should always be greater than Start Time"); } else { if (action == "Insert") { var dtSchedule = ScheduleDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtSchedule.Rows.Count == 0) { // create method itself will return newly created schedule Id var scheduleId = ScheduleDataManager.Create(data, SessionVariables.RequestProfile); data.ScheduleId = scheduleId; // add default schedule questions ApplicationContainer.UI.Web.App_Workflow.ScheduleWorkflow.AddScheduleQuestions(scheduleId, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { data.CreatedDate = CreatedDate; ScheduleDataManager.Update(data, SessionVariables.RequestProfile); } } // not correct ... when doing insert, we didn't get/change the value of ScheduleID ? return(data.ScheduleId); }
public async Task UpdatePersonAddress(PersonId personId, string city, string country, string street, string zipcode) { var person = await _personRepository.GetPerson(personId.ToString()); if (person == null) { return; // throw person not found exception } person.ChangePersonAddress(street, country, zipcode, city); await _personRepository.SavePersonAsync(person); }
private void BindDefaultValues() { cblType.Items.Add(new ListItem(LocRM3.GetString("Event"), ((int)Mediachase.IBN.Business.CalendarView.CalendarFilter.Event).ToString())); cblType.Items.Add(new ListItem(LocRM3.GetString("Meeting"), ((int)Mediachase.IBN.Business.CalendarView.CalendarFilter.Meeting).ToString())); cblType.Items.Add(new ListItem(LocRM3.GetString("Appointment"), ((int)Mediachase.IBN.Business.CalendarView.CalendarFilter.Appointment).ToString())); if (Configuration.ProjectManagementEnabled) { cblType.Items.Add(new ListItem(LocRM3.GetString("Task"), ((int)Mediachase.IBN.Business.CalendarView.CalendarFilter.Task).ToString())); } cblType.Items.Add(new ListItem(LocRM3.GetString("ToDo"), ((int)Mediachase.IBN.Business.CalendarView.CalendarFilter.ToDo).ToString())); foreach (ListItem li in cblType.Items) { li.Selected = true; } using (IDataReader rdr = Mediachase.IBN.Business.CalendarView.GetListPeopleForCalendar()) { while (rdr.Read()) { ddlPerson.Items.Add(new ListItem((string)rdr["LastName"] + " " + (string)rdr["FirstName"], rdr["UserId"].ToString())); } } if (PersonId > 0) { pc["CWrapper_People"] = PersonId.ToString(); } if (Request["Date"] != null) { CalendarCtrl.SelectedDate = DateTime.Parse(Server.UrlDecode(Request["Date"])); } try { string[] timeParts; timeParts = PortalConfig.WorkTimeStart.Split(':'); CalendarCtrl.DayStartHour = int.Parse(timeParts[0]); timeParts = PortalConfig.WorkTimeFinish.Split(':'); CalendarCtrl.DayEndHour = int.Parse(timeParts[0]); } catch { } }
/// <summary> /// Отрисовка назвния лица /// </summary> /// <param name="w">Поток вывода</param> /// <param name="title">Где отрисовываем(в заголовке страницы или нет)</param> protected void RenderCompanyName(TextWriter w, bool title = false) { if (PersonName == null) { InitPerson(); } var name = radioLang.Value == "en" ? PersonNameEn : PersonName; w.Write("{0} ", Resx.GetString("STORE_SP_Lbl_Requisites")); if (!title) { RenderLinkPerson(w, "person_" + PersonId, PersonId.ToString(), name); } else { w.Write(name); } }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj">The Object to compare with the current Object.</param> /// <returns>true if the specified Object is equal to the current Object; otherwise, false.</returns> public override bool Equals(object obj) { var compare = obj as Approver; if (compare == null) { return(false); } if (Helper.HasNullDifference(PersonId, compare.PersonId)) { return(false); } if (PersonId != null && (PersonId.ToString() != compare.PersonId.ToString())) { return(false); } if (PersonFamilyName != compare.PersonFamilyName) { return(false); } if (!StringListCompare(PersonGivenNames, compare.PersonGivenNames)) { return(false); } if (!StringListCompare(PersonNameSuffixes, compare.PersonNameSuffixes)) { return(false); } if (!StringListCompare(PersonTitles, compare.PersonTitles)) { return(false); } return(true); }
/// <summary> /// Renders the <see cref="T:System.Web.UI.HtmlControls.HtmlContainerControl" /> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> that receives the <see cref="T:System.Web.UI.HtmlControls.HtmlContainerControl" /> content.</param> protected override void Render(HtmlTextWriter writer) { this.AddCssClass("popover-person"); HRef = Path.Combine(System.Web.VirtualPathUtility.ToAbsolute("~"), string.Format("Person/{0}", PersonId)); this.Attributes["personId"] = PersonId.ToString(); base.RenderBeginTag(writer); if (PhotoId.HasValue && PhotoId.Value != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-circle"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); } writer.RenderBeginTag(HtmlTextWriterTag.Strong); writer.Write(PersonName); writer.RenderEndTag(); base.RenderEndTag(writer); if (!string.IsNullOrWhiteSpace(Role)) { writer.RenderBeginTag(HtmlTextWriterTag.Small); writer.Write(" ("); writer.Write(Role); writer.Write(")"); writer.RenderEndTag(); } string script = @" $('.popover-person').popover({ placement: 'right', trigger: 'manual', delay: 500, html: true, content: function() { var dataUrl = Rock.settings.get('baseUrl') + 'api/People/PopupHtml/' + $(this).attr('personid'); var result = $.ajax({ type: 'GET', url: dataUrl, dataType: 'json', contentType: 'application/json; charset=utf-8', async: false }).responseText; var resultObject = jQuery.parseJSON(result); return resultObject.PickerItemDetailsHtml; } }).on('mouseenter', function () { var _this = this; $(this).popover('show'); $(this).siblings('.popover').on('mouseleave', function () { $(_this).popover('hide'); }); }).on('mouseleave', function () { var _this = this; setTimeout(function () { if (!$('.popover:hover').length) { $(_this).popover('hide') } }, 100); }); "; ScriptManager.RegisterStartupScript(this, this.GetType(), "person-link-popover", script, true); }
/// <summary> /// Инициализация контролоа /// </summary> private void InitControls() { #region Язык radioLang.IsRow = false; radioLang.Items.Add(new Item { Code = "ru", Name = Resx.GetString("STORE_SP_Lbl_LangRu") }); radioLang.Items.Add(new Item { Code = "en", Name = Resx.GetString("STORE_SP_Lbl_LangEn") }); radioLang.Value = "ru"; radioLang.Changed += RadioLang_Changed; radioLang.NextControl = "flagName"; #endregion #region Название flagName.Changed += FlagName_Changed; flagName.NextControl = "flagINN"; #endregion #region ИНН flagINN.Changed += FlagINN_Changed; flagINN.NextControl = "flagOGRN"; #endregion #region ОГРН flagOGRN.Changed += FlagOGRN_Changed; flagOGRN.NextControl = "flagKPP"; #endregion #region КПП flagKPP.Changed += FlagKPP_Changed; flagKPP.NextControl = "flagAddress"; #endregion #region Адрес flagAddress.Changed += FlagAddress_Changed; flagAddress.NextControl = "flagRS"; #endregion #region асчетный счет dbsStoreRS.Filter.ManagerId.Value = PersonId.ToString(); dbsStoreRS.Filter.StoreResourceId.Value = "183"; dbsStoreRS.Filter.StoreTypeId.Add("1"); dbsStoreRS.Filter.ValidAt.Value = DateTime.Today.ToString("yyyyMMdd"); flagRS.Changed += FlagRS_Changed; dbsStoreRS.IsDisabled = true; dbsStoreRS.NextControl = "flagDirector"; dbsStoreRS.Changed += DBSStoreRS_Changed; #endregion #region Специальный счет dbsStoreSpec.Filter.ManagerId.Value = PersonId.ToString(); dbsStoreSpec.Filter.StoreResourceId.Value = "183"; dbsStoreSpec.Filter.StoreTypeId.Add("8"); dbsStoreSpec.Filter.ValidAt.Value = DateTime.Today.ToString("yyyyMMdd"); flagSpec.Changed += FlagSpec_Changed; dbsStoreSpec.IsDisabled = true; dbsStoreSpec.NextControl = "flagDirector"; dbsStoreSpec.Changed += DBSStoreSpec_Changed; #endregion #region Валютный счет flagValS.Changed += FlagValS_Changed; dbsStoreValS.IsDisabled = true; dbsCurrency.IsDisabled = true; dbsCurrency.NextControl = "dbsStoreValS"; dbsStoreValS.NextControl = "flagDirector"; dbsCurrency.Changed += DBSCurrency_Changed; var listCurrency = GetCurrencyValStore(); if (listCurrency.Count > 0) { listCurrency.ForEach(x => dbsCurrency.Filter.CurrencyId.Add(x.ToString())); } dbsStoreValS.Filter.ManagerId.Value = PersonId.ToString(); dbsStoreValS.Filter.StoreTypeId.Add("2"); dbsStoreValS.Filter.StoreTypeId.Add("3"); dbsStoreValS.Filter.ValidAt.Value = DateTime.Today.ToString("yyyyMMdd"); dbsStoreValS.BeforeSearch += DBSStoreValS_BeforeSearch; dbsStoreValS.Changed += DBSStoreValS_Changed; #endregion #region Директор dbsSign1.IsAlwaysAdvancedSearch = false; dbsSign1.IsAlwaysCreateEntity = true; dbsSign1.Filter.PersonLink = PersonId; dbsSign1.Filter.PersonLinkType = 1; dbsSign1.Filter.PersonLinkValidAt = DateTime.Today; dbsSign1.Filter.PersonSignType = 1; dbsSign1.Changed += DBSSign1_Changed; flagDirector.Changed += FlagDirector_Changed; dbsSign1.IsDisabled = true; dbsSign1.NextControl = "btnPrint"; #endregion }
public override string ToString() { return(PersonId.ToString()); }
/// <summary> /// Execute method to write transaction to the database. /// </summary> public void Execute() { string directory = AppDomain.CurrentDomain.BaseDirectory; directory = Path.Combine(directory, "Logs"); // check that directory exists if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } // create full path to the fie string filePath = Path.Combine(directory, "pageviews.csv"); // write to the file StreamWriter w = new StreamWriter(filePath, true); w.Write("{0},{1},{2},{3},{4},{5}\r\n", DateViewed.ToString(), PageId.ToString(), SiteId.ToString(), PersonId.ToString(), IPAddress, UserAgent); w.Close(); }
public string toString() { return(PersonId.ToString() + " " + FirstName + " " + LastName); }
public string ToRequestString() { return((GetType().GetTypeInfo().GetCustomAttribute(typeof(RequestUrlAttribute)) as RequestUrlAttribute) .Url .Replace("{id}", PersonId.ToString())); }
public string GetPersonId() { return(PersonId?.ToString()); }