private void GetDataActivity(DateTime dt) { mm = new MobilitiesModel(); mm.Date = dt; mm.UserId = Convert.ToInt32(UserIdTxt.Text); SumMobilityTxt.Text = mr.SelectSumMobility(mm).ToString(); ActivityList.DataSource = mr.SelectByDate(mm); ActivityList.DataBind(); }
private void GetData(DateTime dt) { try { mm = new MobilitiesModel(); mm.Date = dt; ActivityList.DataSource = mr.SelectByDate(mm); ActivityList.DataBind(); } catch (Exception ex) { le.SaveLogError(ex); } }
protected void Page_Load(object sender, EventArgs e) { //RedirectToLoginIfAnonymous(); if (IsPostBack) { return; } var parameter = new Parameter("Filter", DbType.String, WebAnnotationPrefix); CrmNoteSource.WhereParameters.Add(parameter); if (Case == null) { actionResultMessage.Text = "Case not found"; CaseInfoPanel.Visible = false; CaseInfoPanelNotes.Visible = false; EditPanel.Visible = false; return; } TitleLabel.Text = Case.Title; CaseNumberLabel.Text = " Case Number: " + Case.TicketNumber; StatusReasonLabel.Text = Enum.GetName(typeof(Enums.IncidentState), Case.StateCode.GetValueOrDefault()); string Description = Case.Description; if (Description != null) { Description = Description.TrimStart(); Description = Description.TrimEnd(); if (Description.Length > 1000) { Description += Description.Substring(1, 999); } descriptionTextBox.Text = Description; } XrmContext.Attach(Case); if (Case.subject_incidents != null) { SubjectLabel.Text = "| Subject: " + Case.subject_incidents.Title; } XrmContext.Detach(Case); CaseTypeLabel.Text = "| Case Type: " + GetCaseTypeCodeOptionLabelByValue(Case.CaseTypeCode.GetValueOrDefault()); CreatedOn.Text = Case.CreatedOn.GetValueOrDefault().ToLocalTime().ToString(); LastModifiedOn.Text = Case.ModifiedOn.GetValueOrDefault().ToLocalTime().ToString(); if (Case.KbArticleId != null) { KB.Text = "Please see the following KB article: <a href=\"/kb/kb-article?id=" + Case.KbArticleId + "\">" + Case.kbarticle_incidents.Title + "</a><br/>"; } var access = ServiceContext.GetCaseAccessByContact(Contact) as Adx_caseaccess; if (access == null || !access.Adx_Write.GetValueOrDefault()) { UpdateFields.Visible = false; UpdateButton.Visible = false; } if (Case.StateCode != (int)Enums.IncidentState.Active) { EditPanel.Enabled = false; UpdateButton.Visible = false; CancelCaseButton.Visible = false; CloseCasePanel.Visible = false; ReopenCase.Visible = true; } ////Get Activities for cases. var result = new List <Entity>(); var activityPointer = from c in XrmContext.CreateQuery("activitypointer") where c.GetAttributeValue <Guid?>("regardingobjectid") == Case.Id select c; result.AddRange(activityPointer); if (result.Count > 0) { foreach (Entity ent in result) { if (!ent.Contains("actualdurationminutes")) { ent.Attributes.Add("actualdurationminutes", "0"); } if (ent.Attributes["activitytypecode"].ToString().Trim() == "email") { if (ent.Contains("description")) { string emailDescription = ent.Attributes["description"].ToString(); emailDescription = StripHtml(emailDescription); if (emailDescription.Length > 1000) { emailDescription = emailDescription.Substring(0, 1999); } ent.Attributes["description"] = emailDescription; } } if (!ent.Contains("description")) { ent.Attributes.Add("description", ""); } } ActivityList.DataKeyNames = new[] { "activityid" }; ActivityList.DataSource = result.ToDataTable(XrmContext); //ActivityList.ColumnsGenerator = new CrmSavedQueryColumnsGenerator("Activities Web View"); ActivityList.DataBind(); } }