public void Invoke(object Sender, object Element) { if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; PrimaryKeyId key = PrimaryKeyId.Parse(cp.CommandArguments["ObjectId"]); string deleteType = cp.CommandArguments["DeleteType"]; // 0: org only; 1: org & contacts int errorCount = 0; string className = OrganizationEntity.GetAssignedMetaClassName(); DeleteRequest request = new DeleteRequest(className, key); request.Parameters.Add(OrganizationRequestParameters.Delete_RelatedContactAction, (deleteType == "0") ? RelatedContactAction.Detach : RelatedContactAction.Delete); try { BusinessManager.Execute(request); } catch (Exception ex) { CHelper.GenerateErrorReport(ex); errorCount++; } if (errorCount > 0) { ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:ActionWasNotProcessed}"); } else { ((Control)Sender).Page.Response.Redirect(CHelper.GetLinkEntityList(className)); } } }
private void BindDictionaries() { lbCategory.DataSource = Document.GetListCategoriesAll(); lbCategory.DataTextField = "CategoryName"; lbCategory.DataValueField = "CategoryId"; lbCategory.DataBind(); // Priority ddlPriority.DataSource = Document.GetListPriorities(); ddlPriority.DataTextField = "PriorityName"; ddlPriority.DataValueField = "PriorityId"; ddlPriority.DataBind(); if (ProjectId > 0) { lblProject.Text = Project.GetProjectTitle(ProjectId); } if (DocumentId <= 0) { ListItem liPriority = ddlPriority.Items.FindByValue(PortalConfig.DocumentDefaultValuePriorityField); if (liPriority != null) { liPriority.Selected = true; } ucTaskTime.Value = DateTime.MinValue.AddMinutes(int.Parse(PortalConfig.DocumentDefaultValueTaskTimeField)); ArrayList list = Common.StringToArrayList(PortalConfig.DocumentDefaultValueGeneralCategoriesField); foreach (int i in list) { CommonHelper.SafeMultipleSelect(lbCategory, i.ToString()); } PrimaryKeyId org_id = PrimaryKeyId.Empty; PrimaryKeyId contact_id = PrimaryKeyId.Empty; Common.GetDefaultClient(PortalConfig.DocumentDefaultValueClientField, out contact_id, out org_id); if (contact_id != PrimaryKeyId.Empty) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = contact_id; } else if (org_id != PrimaryKeyId.Empty) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = org_id; } rbFile.Checked = true; rbFile.Attributes.Add("onclick", "ShowFile()"); rbHTML.Attributes.Add("onclick", "ShowHTML()"); rbLink.Attributes.Add("onclick", "ShowLink()"); rbFile.Text = LocRM.GetString("File"); rbHTML.Text = LocRM.GetString("HTMLText"); rbLink.Text = LocRM.GetString("Link"); rbHTML.Checked = false; rbLink.Checked = false; Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script>window.setTimeout('ShowFile()', 200);</script>"); } }
protected void btnSave_ServerClick(object sender, EventArgs e) { DataTable dt = ((DataTable)ViewState["Resources"]).Copy(); List <CalendarEventResourceEntity> list = new List <CalendarEventResourceEntity>(); foreach (DataRow dr in dt.Rows) { CalendarEventResourceEntity cero = BusinessManager.InitializeEntity <CalendarEventResourceEntity>(CalendarEventResourceEntity.ClassName); string[] elem = dr["Id"].ToString().Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); if (elem[1] != "0") { MetaClass mcEl = MetaDataWrapper.GetMetaClassByName(elem[1]); if (mcEl.IsCard) { elem[1] = mcEl.CardOwner.Name; } } if (elem[1] == "0") { cero.Email = elem[0]; } else if (elem[1] == Principal.GetAssignedMetaClass().Name) { cero.PrincipalId = PrimaryKeyId.Parse(elem[0]); } else if (elem[1] == ContactEntity.GetAssignedMetaClassName()) { cero.ContactId = PrimaryKeyId.Parse(elem[0]); } else if (elem[1] == OrganizationEntity.GetAssignedMetaClassName()) { cero.OrganizationId = PrimaryKeyId.Parse(elem[0]); } cero.Name = dr["Name"].ToString(); cero.Status = (int)eResourceStatus.NotResponded; list.Add(cero); } CalendarEventEntity ceo = (CalendarEventEntity)BusinessManager.Load(CalendarEventEntity.ClassName, _workObjectId); CalendarEventUpdateResourcesRequest req = new CalendarEventUpdateResourcesRequest(ceo, list.ToArray()); BusinessManager.Execute(req); if (Request["CommandName"] != null) { CommandParameters cp = new CommandParameters(Request["CommandName"]); Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); } else { Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, String.Empty); } }
protected void lbAdd_Click(object sender, EventArgs e) { DataTable dt = ((DataTable)ViewState["Resources"]).Copy(); if (!String.IsNullOrEmpty(txtEMail.Text.Trim())) { DataRow[] rows = dt.Select(String.Format("Id='{0}'", String.Format("{0}::0", txtEMail.Text.Trim()))); if (rows.Length == 0) { DataRow dr = dt.NewRow(); dr["Id"] = String.Format("{0}::0", txtEMail.Text.Trim()); dr["Name"] = txtEMail.Text.Trim(); dt.Rows.Add(dr); } txtEMail.Text = String.Empty; } else { string[] mas = EntityGrid.GetCheckedCollection(this.Page, grdMain.ID); if (mas.Length == 0) { mas = hdnValue.Value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); } foreach (string s in mas) { DataRow[] rows = dt.Select(String.Format("Id='{0}'", s)); if (rows.Length > 0) { continue; } DataRow dr = dt.NewRow(); if (ddFilter.SelectedValue == ContactEntity.GetAssignedMetaClassName()) { dr["Id"] = s; dr["Name"] = CHelper.GetEntityTitle(ContactEntity.GetAssignedMetaClassName(), PrimaryKeyId.Parse(s.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0])); } else if (ddFilter.SelectedValue == OrganizationEntity.GetAssignedMetaClassName()) { dr["Id"] = s; dr["Name"] = CHelper.GetEntityTitle(OrganizationEntity.GetAssignedMetaClassName(), PrimaryKeyId.Parse(s.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0])); } else if (ddFilter.SelectedValue == Principal.GetAssignedMetaClass().Name) { dr["Id"] = s; dr["Name"] = CHelper.GetEntityTitle(Principal.GetAssignedMetaClass().Name, PrimaryKeyId.Parse(s.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0])); } dt.Rows.Add(dr); } } ViewState["Resources"] = dt; grdMainSelectedPanel.Update(); CommonEventPart(); hdnValue.Value = String.Empty; }
private void BindSavedValues() { if (_pc["ActivitiesTracking_PrjGrp"] == null) { _pc["ActivitiesTracking_PrjGrp"] = "0"; } else { ddPrjGroup.ClearSelection(); CommonHelper.SafeSelect(ddPrjGroup, _pc["ActivitiesTracking_PrjGrp"].ToString()); } if (_pc["ActivitiesTracking_PrjPhase"] == null) { _pc["ActivitiesTracking_PrjPhase"] = "0"; } else { ddPrjPhase.ClearSelection(); CommonHelper.SafeSelect(ddPrjPhase, _pc["ActivitiesTracking_PrjPhase"].ToString()); } if (_pc["ActivitiesTracking_Status"] == null) { _pc["ActivitiesTracking_Status"] = "0"; } else { ddStatus.ClearSelection(); CommonHelper.SafeSelect(ddStatus, _pc["ActivitiesTracking_Status"].ToString()); } //Client if (_pc["ActivitiesTracking_ClientNew"] != null && (!Page.IsPostBack || ClientControl.ObjectId == PrimaryKeyId.Empty)) { string ss = _pc["ActivitiesTracking_ClientNew"]; if (ss.IndexOf("_") >= 0) { string stype = ss.Substring(0, ss.IndexOf("_")); if (stype.ToLower() == "org") { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = PrimaryKeyId.Parse(ss.Substring(ss.IndexOf("_") + 1)); } else if (stype.ToLower() == "contact") { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = PrimaryKeyId.Parse(ss.Substring(ss.IndexOf("_") + 1)); } else { ClientControl.ObjectType = String.Empty; ClientControl.ObjectId = PrimaryKeyId.Empty; } } } }
private static void InsertOrganizationDictionaryItemList(XmlNode ownerNode, string GroupName) { XmlNode xmlNewRootNode = ownerNode.OwnerDocument.CreateElement(GroupName); EntityObject[] list = BusinessManager.List(OrganizationEntity.GetAssignedMetaClassName(), null, new Mediachase.Ibn.Data.SortingElement[] { Mediachase.Ibn.Data.SortingElement.Ascending("Name") }); foreach (OrganizationEntity org in list) { InsertDictionaryItem(xmlNewRootNode, org.Name, org.PrimaryKeyId.ToString()); } ownerNode.AppendChild(xmlNewRootNode); }
private void imbSave_ServerClick(object sender, EventArgs e) { EMailRouterPop3BoxSettings ib = EMailRouterPop3BoxSettings.Load(BoxId); DefaultEMailIncidentMappingBlock dimb = ib.DefaultEMailIncidentMappingBlock; dimb.DescriptionId = Convert.ToInt32(ddDescription.SelectedValue, CultureInfo.InvariantCulture); dimb.DefaultCreator = int.Parse(ddCreator.SelectedValue); dimb.ProjectId = ucProject.ObjectId; dimb.IncidentBoxId = int.Parse(ddIssBox.SelectedValue); dimb.PriorityId = int.Parse(ddPriority.SelectedValue); dimb.TypeId = int.Parse(ddType.SelectedValue); dimb.OrgUid = PrimaryKeyId.Empty; dimb.ContactUid = PrimaryKeyId.Empty; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName()) { dimb.OrgUid = ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName()) { dimb.ContactUid = ClientControl.ObjectId; } dimb.SeverityId = int.Parse(ddSeverity.SelectedValue); ArrayList alGen = new ArrayList(); foreach (ListItem liItem in lbGenCats.Items) { if (liItem.Selected) { alGen.Add(int.Parse(liItem.Value)); } } ArrayList alIss = new ArrayList(); foreach (ListItem liItem in lbIssCats.Items) { if (liItem.Selected) { alIss.Add(int.Parse(liItem.Value)); } } dimb.GeneralCategories = alGen; dimb.IncidentCategories = alIss; EMailRouterPop3BoxSettings.Save(ib); Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language=javascript>" + "try {window.opener.location.href=window.opener.location.href;}" + "catch (e){} window.close();</script>"); }
private void GetObjectData() { FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = FilterElement.EqualElement("EventId", _workObjectId); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventResourceEntity.ClassName, fec.ToArray()); DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Id", typeof(string))); dt.Columns.Add(new DataColumn("Name", typeof(string))); DataRow dr; foreach (EntityObject eo in list) { dr = dt.NewRow(); CalendarEventResourceEntity cero = (CalendarEventResourceEntity)eo; if (cero.ContactId.HasValue) { dr["Id"] = String.Format("{0}::{1}", cero.ContactId.Value.ToString(), ContactEntity.GetAssignedMetaClassName()); dr["Name"] = cero.Contact; } else if (cero.OrganizationId.HasValue) { dr["Id"] = String.Format("{0}::{1}", cero.OrganizationId.Value.ToString(), OrganizationEntity.GetAssignedMetaClassName()); dr["Name"] = cero.Organization; } else if (cero.PrincipalId.HasValue) { dr["Id"] = String.Format("{0}::{1}", cero.PrincipalId.Value.ToString(), Principal.GetAssignedMetaClass().Name); dr["Name"] = cero.Principal; } else { dr["Id"] = String.Format("{0}::0", cero.Email); dr["Name"] = cero.Email; } dt.Rows.Add(dr); } ViewState["Resources"] = dt; }
private void BindValues() { EMailRouterPop3BoxSettings ib = EMailRouterPop3BoxSettings.Load(BoxId); DefaultEMailIncidentMappingBlock dimb = ib.DefaultEMailIncidentMappingBlock; Util.CommonHelper.SafeSelect(ddCreator, dimb.DefaultCreator.ToString()); ucProject.ObjectTypeId = (int)ObjectTypes.Project; ucProject.ObjectId = dimb.ProjectId; Util.CommonHelper.SafeSelect(ddIssBox, dimb.IncidentBoxId.ToString()); Util.CommonHelper.SafeSelect(ddPriority, dimb.PriorityId.ToString()); Util.CommonHelper.SafeSelect(ddType, dimb.TypeId.ToString()); Util.CommonHelper.SafeSelect(ddSeverity, dimb.SeverityId.ToString()); foreach (int catid in dimb.GeneralCategories) { Util.CommonHelper.SafeMultipleSelect(lbGenCats, catid.ToString()); } foreach (int catid in dimb.IncidentCategories) { Util.CommonHelper.SafeMultipleSelect(lbIssCats, catid.ToString()); } if (dimb.OrgUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = dimb.OrgUid; } else if (dimb.ContactUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = dimb.ContactUid; } if (dimb.DescriptionId == 0) { ddDescription.SelectedIndex = 1; } else { ddDescription.SelectedIndex = 0; } //trClient.Visible = PortalConfig.CommonIncidentAllowEditClientField; //trPriority.Visible = PortalConfig.CommonIncidentAllowEditPriorityField; //trType.Visible = PortalConfig.IncidentAllowEditTypeField; //trSeverity.Visible = PortalConfig.IncidentAllowEditSeverityField; //trCategories.Visible = PortalConfig.CommonIncidentAllowEditGeneralCategoriesField; //trIssCategories.Visible = PortalConfig.IncidentAllowEditIncidentCategoriesField; }
private void SaveValues() { Page.Validate(); if (!Page.IsValid) { return; } _pc[_strPref + "DocumentList_Manager"] = ddManager.SelectedValue; _pc[_strPref + "DocumentList_Priority"] = ddPriority.SelectedValue; _pc[_strPref + "DocumentList_Keyword"] = tbKeyword.Text; try { _pc[_strPref + "DocumentList_Project"] = ddlProject.SelectedValue; } catch { } _pc[_strPref + "DocumentList_Status"] = ddStatus.SelectedValue; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { _pc[_strPref + "DocumentList_ClientNew"] = "org_" + ClientControl.ObjectId.ToString(); } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { _pc[_strPref + "DocumentList_ClientNew"] = "contact_" + ClientControl.ObjectId.ToString(); } else { _pc[_strPref + "DocumentList_ClientNew"] = "_"; } // General Categories _pc[_strPref + "DocumentList_GenCatType"] = ddGenCatType.SelectedValue; ArrayList alGenCats = new ArrayList(); foreach (ListItem liItem in lbGenCats.Items) { if (liItem.Selected && !alGenCats.Contains(int.Parse(liItem.Value))) { alGenCats.Add(int.Parse(liItem.Value)); } } Document.SaveGeneralCategories(alGenCats); }
private void SaveValues() { _pc["ActivitiesTracking_PrjGrp"] = ddPrjGroup.SelectedValue; _pc["ActivitiesTracking_PrjPhase"] = ddPrjPhase.SelectedValue; _pc["ActivitiesTracking_Status"] = ddStatus.SelectedValue; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { _pc["ActivitiesTracking_ClientNew"] = "org_" + ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { _pc["ActivitiesTracking_ClientNew"] = "contact_" + ClientControl.ObjectId; } else { _pc["ActivitiesTracking_ClientNew"] = "_"; } }
public void Invoke(object Sender, object Element) { if (Element is CommandParameters && !String.IsNullOrEmpty(((Control)Sender).Page.Request["ObjectId"])) { CommandParameters cp = (CommandParameters)Element; if (cp.CommandArguments["primaryKeyId"] == null) { throw new ArgumentException("PrimaryKeyId is null for SetPrimaryContactEnableHandler"); } PrimaryKeyId contactPk = PrimaryKeyId.Parse(cp.CommandArguments["primaryKeyId"]); PrimaryKeyId orgPk = PrimaryKeyId.Parse(((Control)Sender).Page.Request["ObjectId"]); EntityObject entity = BusinessManager.Load(OrganizationEntity.GetAssignedMetaClassName(), orgPk); entity.Properties["PrimaryContactId"].Value = contactPk; BusinessManager.Update(entity); CHelper.RequireDataBind(); } }
private void BindDGOrganizations(string keyword) { FilterElement fe = CHelper.GetSearchFilterElementByKeyword(keyword, OrganizationEntity.GetAssignedMetaClassName()); FilterElementCollection fec = new FilterElementCollection(); fec.Add(fe); dgOrganizations.DataSource = BusinessManager.List(OrganizationEntity.GetAssignedMetaClassName(), fec.ToArray()); dgOrganizations.DataBind(); int RowCount = dgOrganizations.Items.Count; if (RowCount == 0) { Sep11.Visible = false; Pan11.Visible = false; } else { Sep11.Title = String.Format("{0} ({1})", LocRM.GetString("Organizations"), RowCount); } }
public void Invoke(object Sender, object Element) { if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; string[] selectedElements = EntityGrid.GetCheckedCollection(((CommandManager)Sender).Page, cp.CommandArguments["GridId"]); string deleteType = cp.CommandArguments["DeleteType"]; // 0: org only; 1: org & contacts if (selectedElements != null) { string className = OrganizationEntity.GetAssignedMetaClassName(); int errorCount = 0; foreach (string elem in selectedElements) { string id = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0]; PrimaryKeyId key = PrimaryKeyId.Parse(id); try { DeleteRequest request = new DeleteRequest(className, key); request.Parameters.Add(OrganizationRequestParameters.Delete_RelatedContactAction, (deleteType == "0") ? RelatedContactAction.Detach : RelatedContactAction.Delete); BusinessManager.Execute(request); } catch (Exception ex) { CHelper.GenerateErrorReport(ex); errorCount++; } } if (errorCount > 0) { ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:NotAllSelectedItemsWereProcessed}"); } } } }
private void SaveValues() { _pc["MV_User"] = ddUser.SelectedValue; _pc["MV_Manager"] = ddManager.SelectedValue; _pc["MV_Project"] = ddPrjs.SelectedValue; _pc["MV_Category"] = ddCategory.SelectedValue; _pc["MV_Completed"] = ddCompleted.SelectedValue; _pc["MV_Upcoming"] = ddUpcoming.SelectedValue; _pc["MV_Active"] = ddShowActive.SelectedValue; _pc["MV_Created"] = ddCreated.SelectedValue; if (ddCreated.SelectedValue == "9") // custom { _pc["MV_CreatedFrom"] = dtcStartDate.SelectedDate.Date.ToString(CultureInfo.InvariantCulture); _pc["MV_CreatedTo"] = dtcEndDate.SelectedDate.Date.ToString(CultureInfo.InvariantCulture); } if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { _pc["MV_ClientNew"] = "org_" + ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { _pc["MV_ClientNew"] = "contact_" + ClientControl.ObjectId; } else { _pc["MV_ClientNew"] = "_"; } _pc["MV_ShowEvents"] = cbCalEntries.Checked.ToString(); _pc["MV_ShowIssues"] = cbIssues.Checked.ToString(); _pc["MV_ShowDocs"] = cbDocs.Checked.ToString(); _pc["MV_ShowTasks"] = cbTasks.Checked.ToString(); _pc["MV_ShowToDo"] = cbToDo.Checked.ToString(); _pc["MV_ShowChildTodo"] = ChildTodoCheckbox.Checked.ToString(); }
public bool IsEnable(object Sender, object Element) { bool retval = false; if (Element is CommandParameters && !String.IsNullOrEmpty(((Control)Sender).Page.Request["ObjectId"])) { CommandParameters cp = (CommandParameters)Element; if (cp.CommandArguments["primaryKeyId"] == null) { throw new ArgumentException("PrimaryKeyId is null for SetPrimaryContactEnableHandler"); } PrimaryKeyId contactPk = PrimaryKeyId.Parse(cp.CommandArguments["primaryKeyId"]); PrimaryKeyId orgPk = PrimaryKeyId.Parse(((Control)Sender).Page.Request["ObjectId"]); EntityObject orgEntity = BusinessManager.Load(OrganizationEntity.GetAssignedMetaClassName(), orgPk); PrimaryKeyId?primaryContactId = (PrimaryKeyId?)orgEntity.Properties["PrimaryContactId"].Value; retval = !primaryContactId.HasValue || ((primaryContactId.Value) != contactPk); } return(retval); }
private void BindData() { lblGroupTitle.Text = LocRM.GetString("GroupTitle"); if (edit == "1") { string gTitle = ""; PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; using (IDataReader rdr = SecureGroup.GetGroup(groupId)) { if (rdr.Read()) { gTitle = (string)rdr["GroupName"]; if (rdr["OrgUid"] != DBNull.Value) { orgUid = PrimaryKeyId.Parse(rdr["OrgUid"].ToString()); } if (rdr["ContactUid"] != DBNull.Value) { contactUid = PrimaryKeyId.Parse(rdr["ContactUid"].ToString()); } } } tbGroupTitle.Text = HttpUtility.HtmlDecode(gTitle); if (groupId == (int)InternalSecureGroups.Partner || SecureGroup.IsPartner(groupId)) { using (IDataReader reader = SecureGroup.GetListGroupsByPartner(groupId)) { while (reader.Read()) { lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString())); } } for (int i = 0; i < lbSelectedGroups.Items.Count; i++) { if (lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value) != null) { lbAvailableGroups.Items.Remove(lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value)); } iGroups.Value += lbSelectedGroups.Items[i].Value + ","; } if (orgUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = orgUid; } else if (contactUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = contactUid; } else { ClientControl.ObjectType = String.Empty; ClientControl.ObjectId = PrimaryKeyId.Empty; } } } }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { Page.Validate(); if (!Page.IsValid) { return; } txtTitle.Text = HttpUtility.HtmlEncode(txtTitle.Text); txtGoals.Text = HttpUtility.HtmlEncode(txtGoals.Text); txtScope.Text = HttpUtility.HtmlEncode(txtScope.Text); txtDescription.Text = HttpUtility.HtmlEncode(txtDescription.Text); txtDeliverables.Text = HttpUtility.HtmlEncode(txtDeliverables.Text); int iManager = 0; if (ddlManager.Visible) { iManager = int.Parse(ddlManager.SelectedItem.Value); } else { iManager = int.Parse(iManagerId.Value); } ArrayList alCategories = new ArrayList(); for (int i = 0; i < lbCategory.Items.Count; i++) { if (lbCategory.Items[i].Selected) { alCategories.Add(int.Parse(lbCategory.Items[i].Value)); } } ArrayList alPCategories = new ArrayList(); for (int i = 0; i < lbProjectCategory.Items.Count; i++) { if (lbProjectCategory.Items[i].Selected) { alPCategories.Add(int.Parse(lbProjectCategory.Items[i].Value)); } } bool fromtemplate = false; ArrayList alPort = new ArrayList(); for (int i = 0; i < lbPortfolios.Items.Count; i++) { if (lbPortfolios.Items[i].Selected) { alPort.Add(int.Parse(lbPortfolios.Items[i].Value)); } } PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName()) { orgUid = ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName()) { contactUid = ClientControl.ObjectId; } if (PID != 0) { Project2.Update(PID, txtTitle.Text, txtDescription.Text, txtGoals.Text, txtScope.Text, txtDeliverables.Text, iManager, int.Parse(ddlExecManager.SelectedItem.Value), dtcTargetStartDate.SelectedDate.Date, dtcTargetEndDate.SelectedDate.Date, dtcActualStartDate.SelectedDate.Date, dtcActualFinishDate.SelectedDate.Date, int.Parse(ddlStatus.SelectedItem.Value), int.Parse(ddlType.SelectedItem.Value), int.Parse(ddlCalendar.SelectedItem.Value), contactUid, orgUid, int.Parse(ddCurrency.SelectedItem.Value), int.Parse(ddlPriority.SelectedItem.Value), int.Parse(ddInitialPhase.SelectedValue), int.Parse(ddPrjPhases.SelectedValue), int.Parse(ddlOverallStatus.SelectedValue), int.Parse(ddlRiskLevel.SelectedItem.Value), int.Parse(ddlBlockType.SelectedValue), alCategories, alPCategories, alPort); } else { PID = Project.Create(txtTitle.Text, txtDescription.Text, txtGoals.Text, txtScope.Text, txtDeliverables.Text, iManager, int.Parse(ddlExecManager.SelectedItem.Value), dtcTargetStartDate.SelectedDate, dtcTargetEndDate.SelectedDate, dtcActualStartDate.SelectedDate, dtcActualFinishDate.SelectedDate, int.Parse(ddlStatus.SelectedItem.Value), int.Parse(ddlType.SelectedItem.Value), int.Parse(ddlCalendar.SelectedItem.Value), contactUid, orgUid, int.Parse(ddCurrency.SelectedItem.Value), int.Parse(ddlPriority.SelectedItem.Value), int.Parse(ddInitialPhase.SelectedValue), int.Parse(ddPrjPhases.SelectedValue), int.Parse(ddlOverallStatus.SelectedValue), int.Parse(ddlRiskLevel.SelectedItem.Value), int.Parse(ddlBlockType.SelectedValue), alCategories, alPCategories, alPort); if (int.Parse(ddlTemplate.SelectedValue) > 0) { fromtemplate = true; } } // Save meta field info EditControl.Save(PID); if (fromtemplate) { BindTemplateValues(int.Parse(ddlTemplate.SelectedValue), PID); if (!cbOneMore.Checked) { Response.Redirect("../Projects/ProjectView.aspx?ProjectID=" + PID + "&Tab=1&TemplateId=" + ddlTemplate.SelectedValue); } else { Response.Redirect("../Projects/ProjectEdit.aspx?OldProjectId=" + PID + "&TemplateId=" + ddlTemplate.SelectedValue); } } else { if (cbOneMore.Checked) { Response.Redirect("../Projects/ProjectEdit.aspx"); } else { Response.Redirect("../Projects/ProjectView.aspx?ProjectID=" + PID); } } }
private static void ConvertOrganizations(Dictionary <int, OrganizationEntity> organizationsById) { Dictionary <int, Dictionary <string, object> > additionalFields = new Dictionary <int, Dictionary <string, object> >(); // Load organizations list using (IDataReader reader = DBHelper2.DBHelper.RunTextDataReader("SELECT [OrgId],[OrgName] FROM [ORGANIZATIONS]")) { while (reader.Read()) { int id = (int)reader["OrgId"]; string name = (string)reader["OrgName"]; Dictionary <string, object> additionalValues = new Dictionary <string, object>(); additionalValues.Add("Name", name); additionalFields.Add(id, additionalValues); } } MD47.Meta.Management.MetaClass metaClass47 = MD47.DataContext.Current.MetaModel.MetaClasses[OrganizationEntity.GetAssignedMetaClassName()]; MD45.Configurator.MetaClass metaClass45 = MD45.Configurator.MetaClass.Load("OrganizationsEx"); MetadataPlusToMetadataConverter converter = new MetadataPlusToMetadataConverter(metaClass45, metaClass47, "old_", additionalFields); converter.CopyFields(); converter.CopyEntities(organizationsById); }
protected void Page_Load(object sender, EventArgs e) { // O.R.: IBN 4.7 fix - check that partner can see the client if (ClassName == OrganizationEntity.GetAssignedMetaClassName()) { if (!CommonHelper.CanViewOrganization(ObjectId)) { throw new AccessDeniedException(); } } if (ClassName == ContactEntity.GetAssignedMetaClassName()) { if (!CommonHelper.CanViewContact(ObjectId)) { throw new AccessDeniedException(); } } // CHelper.AddToContext("ClassName", ClassName); CHelper.AddToContext("ObjectId", ObjectId); this.Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete); xmlStruct.InnerDataBind += new XmlFormBuilder.InnerDataBindEventHandler(xmlStruct_InnerDataBind); if (!Page.IsPostBack) { // Config/Layout/[LayoutType].[ClassName].[PlaceName].xml xmlStruct.LayoutType = LayoutType.EntityView; if (!String.IsNullOrEmpty(PlaceName)) { xmlStruct.PlaceName = PlaceName; } xmlStruct.LayoutMode = LayoutMode.LeftMenu; // O.R.[2008-11-02]: Ibn 4.7 hack. // По-нормальному надо вводить на уровне класса атрибут ViewLayoutMode. // При создании/редактировании метакласса определять способ отображения - // с табами или с левым меню if (ClassName == "CustomizationProfile" || ClassName == "WorkflowInstance") { xmlStruct.LayoutMode = LayoutMode.WithTabs; } if (_bindObject == null) { try { _bindObject = BusinessManager.Load(ClassName, ObjectId); } catch { Response.Redirect("~/Common/NotExistingId.aspx?ClassName=" + ClassName, true); } } //if (ClassName != ((EntityObject)_bindObject).MetaClassName) // ClassName = ((EntityObject)_bindObject).MetaClassName; xmlStruct.ClassName = ClassName; xmlStruct.CheckVisibleTab = _bindObject; xmlStruct.DataBind(); Mediachase.IBN.Business.Common.AddEntityHistory(ClassName, ObjectId); } }
private void BindValues() { ddlTemplate.DataSource = ProjectTemplate.GetListProjectTemplate(); ddlTemplate.DataTextField = "TemplateName"; ddlTemplate.DataValueField = "TemplateId"; ddlTemplate.DataBind(); ddlTemplate.Items.Insert(0, new ListItem(LocRM.GetString("NotSet"), "0")); if (Request["TemplateId"] != null) { CommonHelper.SafeSelect(ddlTemplate, Request["TemplateId"].ToString()); } ddlStatus.DataSource = Project.GetListProjectStatus(); ddlStatus.DataTextField = "StatusName"; ddlStatus.DataValueField = "StatusId"; ddlStatus.DataBind(); ddPrjPhases.DataSource = Project.GetListProjectPhases(); ddPrjPhases.DataTextField = "PhaseName"; ddPrjPhases.DataValueField = "PhaseId"; ddPrjPhases.DataBind(); ddInitialPhase.DataSource = Project.GetListProjectPhases(); ddInitialPhase.DataTextField = "PhaseName"; ddInitialPhase.DataValueField = "PhaseId"; ddInitialPhase.DataBind(); ddlType.DataValueField = "TypeId"; ddlType.DataTextField = "TypeName"; ddlType.DataSource = Project.GetListProjectTypes(); ddlType.DataBind(); ddlBlockType.DataTextField = "Title"; ddlBlockType.DataValueField = "primaryKeyId"; ddlBlockType.DataSource = Mediachase.IbnNext.TimeTracking.TimeTrackingBlockType.List(Mediachase.Ibn.Data.FilterElement.EqualElement("IsProject", "1")); ddlBlockType.DataBind(); ddlOverallStatus.Items.Clear(); for (int i = 0; i <= 100; i++) { ddlOverallStatus.Items.Add(new ListItem(i.ToString() + " %", i.ToString())); } BindGeneralCategories(); BindProjectCategories(); BindPortfolios(); ddlCalendar.DataTextField = "CalendarName"; ddlCalendar.DataValueField = "CalendarId"; ddlCalendar.DataSource = Project.GetListCalendars(PID); ddlCalendar.DataBind(); ddlPriority.DataTextField = "PriorityName"; ddlPriority.DataValueField = "PriorityId"; ddlPriority.DataSource = Project.GetListPriorities(); ddlPriority.DataBind(); ddlRiskLevel.DataTextField = "RiskLevelName"; ddlRiskLevel.DataValueField = "RiskLevelId"; ddlRiskLevel.DataSource = Project.GetListRiskLevels(); ddlRiskLevel.DataBind(); dtcTargetStartDate.SelectedDate = UserDateTime.UserToday; dtcTargetEndDate.SelectedDate = UserDateTime.UserToday.AddMonths(1); ddCurrency.DataTextField = "CurrencySymbol"; ddCurrency.DataValueField = "CurrencyId"; ddCurrency.DataSource = Project.GetListCurrency(); ddCurrency.DataBind(); // Managers ListItem li; ArrayList alManagers = new ArrayList(); using (IDataReader iManagers = SecureGroup.GetListAllUsersInGroup((int)InternalSecureGroups.ProjectManager)) { while (iManagers.Read()) { li = new ListItem(iManagers["LastName"].ToString() + " " + iManagers["FirstName"].ToString(), iManagers["UserId"].ToString()); alManagers.Add(li); } } if (Security.IsUserInGroup(InternalSecureGroups.PowerProjectManager)) { int CurrentUserID = Security.UserID; for (int i = 0; i < alManagers.Count; i++) { ddlManager.Items.Add((ListItem)alManagers[i]); } li = ddlManager.Items.FindByValue(CurrentUserID.ToString()); if (li != null) { li.Selected = true; } } else { lblManager.Visible = true; ddlManager.Visible = false; lblManager.Text = CommonHelper.GetUserStatus((Security.CurrentUser.UserID)); iManagerId.Value = Security.CurrentUser.UserID.ToString(); } // Exec Managers li = new ListItem(LocRM.GetString("NotSet"), "0"); ddlExecManager.Items.Add(li); using (IDataReader iManagers = SecureGroup.GetListAllUsersIn2Group((int)InternalSecureGroups.ProjectManager, (int)InternalSecureGroups.ExecutiveManager)) { while (iManagers.Read()) { ddlExecManager.Items.Add(new ListItem(iManagers["LastName"].ToString() + " " + iManagers["FirstName"].ToString(), iManagers["UserId"].ToString())); } } if (PID != 0) { // ddlBlockType.Enabled = false; using (IDataReader reader = Project.GetProject(PID)) { if (reader.Read()) { if (reader["OrgUid"] != DBNull.Value) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = PrimaryKeyId.Parse(reader["OrgUid"].ToString()); } else if (reader["ContactUid"] != DBNull.Value) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = PrimaryKeyId.Parse(reader["ContactUid"].ToString()); } txtTitle.Text = HttpUtility.HtmlDecode(reader["Title"].ToString()); txtGoals.Text = HttpUtility.HtmlDecode(reader["Goals"].ToString()); txtScope.Text = HttpUtility.HtmlDecode(reader["Scope"].ToString()); txtDescription.Text = HttpUtility.HtmlDecode(reader["Description"].ToString()); txtDeliverables.Text = HttpUtility.HtmlDecode(reader["Deliverables"].ToString()); CommonHelper.SafeSelect(ddlType, reader["TypeId"].ToString()); CommonHelper.SafeSelect(ddlCalendar, reader["CalendarId"].ToString()); CommonHelper.SafeSelect(ddCurrency, reader["CurrencyId"].ToString()); CommonHelper.SafeSelect(ddlPriority, reader["PriorityId"].ToString()); CommonHelper.SafeSelect(ddlRiskLevel, reader["RiskLevelId"].ToString()); CommonHelper.SafeSelect(ddlOverallStatus, reader["PercentCompleted"].ToString()); if (reader["BlockTypeId"] != DBNull.Value) { CommonHelper.SafeSelect(ddlBlockType, reader["BlockTypeId"].ToString()); } ddlExecManager.Items.FindByText(LocRM.GetString("NotSet")).Selected = true; if (reader["ExecutiveManagerId"] != DBNull.Value) { string str = ""; str = reader["ExecutiveManagerId"].ToString(); ListItem liExec = ddlExecManager.Items.FindByValue(reader["ExecutiveManagerId"].ToString()); if (liExec != null) { ddlExecManager.ClearSelection(); liExec.Selected = true; } } if (reader["ManagerId"] != DBNull.Value) { if (ddlManager.Visible) { ListItem liClient = ddlManager.Items.FindByValue(reader["ManagerId"].ToString()); if (liClient != null) { ddlManager.ClearSelection(); liClient.Selected = true; } } else { int iManager = (int)reader["ManagerId"]; iManagerId.Value = iManager.ToString(); lblManager.Text = CommonHelper.GetUserStatus(iManager); } } if (reader["StatusId"] != DBNull.Value) { ListItem liStatus = ddlStatus.Items.FindByValue(reader["StatusId"].ToString()); if (liStatus != null) { ddlStatus.ClearSelection(); liStatus.Selected = true; } } if (reader["PhaseId"] != DBNull.Value) { ListItem liPhase = ddPrjPhases.Items.FindByValue(reader["PhaseId"].ToString()); if (liPhase != null) { ddPrjPhases.ClearSelection(); liPhase.Selected = true; } } if (reader["InitialPhaseId"] != DBNull.Value) { ListItem liPhase = ddInitialPhase.Items.FindByValue(reader["InitialPhaseId"].ToString()); if (liPhase != null) { ddInitialPhase.ClearSelection(); liPhase.Selected = true; } } dtcTargetStartDate.SelectedDate = (DateTime)reader["TargetStartDate"]; dtcTargetEndDate.SelectedDate = (DateTime)reader["TargetFinishDate"]; if (reader["ActualStartDate"] != DBNull.Value && reader["ActualStartDate"].ToString() != "") { dtcActualStartDate.SelectedDate = (DateTime)reader["ActualStartDate"]; } if (reader["ActualFinishDate"] != DBNull.Value && reader["ActualFinishDate"].ToString() != "") { dtcActualFinishDate.SelectedDate = (DateTime)reader["ActualFinishDate"]; } } } using (IDataReader reader = Project.GetListCategories(PID)) { while (reader.Read()) { for (int i = 0; i < lbCategory.Items.Count; i++) { ListItem lItem = lbCategory.Items.FindByText(reader["CategoryName"].ToString()); if (lItem != null) { lItem.Selected = true; } } } } using (IDataReader reader = Project.GetListProjectCategoriesByProject(PID)) { while (reader.Read()) { for (int i = 0; i < lbProjectCategory.Items.Count; i++) { ListItem lItem = lbProjectCategory.Items.FindByText(reader["CategoryName"].ToString()); if (lItem != null) { lItem.Selected = true; } } } } using (IDataReader reader = ProjectGroup.ProjectGroupsGetByProject(PID)) { while (reader.Read()) { for (int i = 0; i < lbPortfolios.Items.Count; i++) { ListItem lItem = lbPortfolios.Items.FindByValue(reader["ProjectGroupId"].ToString()); if (lItem != null) { lItem.Selected = true; } } } } } else { // Client PrimaryKeyId org_id = PrimaryKeyId.Empty; PrimaryKeyId contact_id = PrimaryKeyId.Empty; Common.GetDefaultClient(PortalConfig.ProjectDefaultValueClientField, out contact_id, out org_id); if (contact_id != PrimaryKeyId.Empty) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = contact_id; } else if (org_id != PrimaryKeyId.Empty) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = org_id; } // Priority Util.CommonHelper.SafeSelect(ddlPriority, PortalConfig.ProjectDefaultValuePriorityField); // Currency Util.CommonHelper.SafeSelect(ddCurrency, PortalConfig.ProjectDefaultValueCurrencyField); // Categories ArrayList list = Common.StringToArrayList(PortalConfig.ProjectDefaultValueGeneralCategoriesField); foreach (int i in list) { CommonHelper.SafeMultipleSelect(lbCategory, i.ToString()); } list = Common.StringToArrayList(PortalConfig.ProjectDefaultValueProjectCategoriesField); foreach (int i in list) { CommonHelper.SafeMultipleSelect(lbProjectCategory, i.ToString()); } // texts txtGoals.Text = PortalConfig.ProjectDefaultValueGoalsField; txtDeliverables.Text = PortalConfig.ProjectDefaultValueDeliverablesField; txtScope.Text = PortalConfig.ProjectDefaultValueScopeField; } if (PID > 0) { EditControl.ObjectId = PID; } EditControl.MetaClassName = String.Concat("ProjectsEx_", ddlType.SelectedValue); EditControl.BindData(); trPriority.Visible = PortalConfig.CommonProjectAllowEditPriorityField; trClient.Visible = PortalConfig.CommonProjectAllowEditClientField; trCategories.Visible = PortalConfig.CommonProjectAllowEditGeneralCategoriesField; trProjectCategories.Visible = PortalConfig.ProjectAllowEditProjectCategoriesField; GoalsRow.Visible = PortalConfig.ProjectAllowEditGoalsField; DeleverablesRow.Visible = PortalConfig.ProjectAllowEditDeliverablesField; ScopeRow.Visible = PortalConfig.ProjectAllowEditScopeField; LeftTextCell.Visible = GoalsRow.Visible || DeleverablesRow.Visible; }
private void BindSavedValues() { ListViewProfile profile = ListViewProfile.Load(_className, _uid, String.Empty); CHelper.SafeSelect(ddFieldSets, profile.FieldSetName); CHelper.SafeSelect(ddGroupField, String.IsNullOrEmpty(profile.GroupByFieldName) ? Project.AvailableGroupField.NotSet.ToString() : profile.GroupByFieldName); txtTitle.Text = profile.Name; cbIsPublic.Checked = profile.IsPublic; #region Filters FilterElementCollection fec = profile.Filters; foreach (FilterElement fe in fec) { switch (fe.Source) { case Project.StatusFilterKey: CHelper.SafeSelect(ddStatus, fe.Value.ToString()); break; case Project.PhaseFilterKey: CHelper.SafeSelect(ddPrjPhases, fe.Value.ToString()); break; case Project.TypeFilterKey: CHelper.SafeSelect(ddType, fe.Value.ToString()); break; case Project.PriorityFilterKey: CHelper.SafeSelect(ddPriority, fe.Value.ToString()); break; case Project.StartDateFilterKey: switch (fe.Type) { case FilterElementType.GreaterOrEqual: CHelper.SafeSelect(ddSDType, "1"); dtcStartDate.SelectedDate = DateTime.Parse(fe.Value.ToString(), CultureInfo.InvariantCulture); break; case FilterElementType.LessOrEqual: CHelper.SafeSelect(ddSDType, "2"); dtcStartDate.SelectedDate = DateTime.Parse(fe.Value.ToString(), CultureInfo.InvariantCulture); break; case FilterElementType.Equal: CHelper.SafeSelect(ddSDType, "3"); dtcStartDate.SelectedDate = DateTime.Parse(fe.Value.ToString(), CultureInfo.InvariantCulture); break; default: CHelper.SafeSelect(ddSDType, "0"); break; } break; case Project.EndDateFilterKey: switch (fe.Type) { case FilterElementType.GreaterOrEqual: CHelper.SafeSelect(ddFDType, "1"); dtcEndDate.SelectedDate = DateTime.Parse(fe.Value.ToString(), CultureInfo.InvariantCulture); break; case FilterElementType.LessOrEqual: CHelper.SafeSelect(ddFDType, "2"); dtcEndDate.SelectedDate = DateTime.Parse(fe.Value.ToString(), CultureInfo.InvariantCulture); break; case FilterElementType.Equal: CHelper.SafeSelect(ddFDType, "3"); dtcEndDate.SelectedDate = DateTime.Parse(fe.Value.ToString(), CultureInfo.InvariantCulture); break; default: break; } break; case Project.ManagerFilterKey: CHelper.SafeSelect(ddManager, fe.Value.ToString()); break; case Project.ExecManagerFilterKey: CHelper.SafeSelect(ddExeManager, fe.Value.ToString()); break; case Project.ClientFilterKey: PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; Incident.GetContactId(fe.Value.ToString(), out orgUid, out contactUid); if (orgUid != PrimaryKeyId.Empty) { ClientControl.ObjectId = orgUid; ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); } else if (contactUid != PrimaryKeyId.Empty) { ClientControl.ObjectId = contactUid; ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); } break; case Project.GenCategoryTypeFilterKey: CHelper.SafeSelect(ddGenCatType, fe.Value.ToString()); break; case Project.GenCategoriesFilterKey: string[] mas = fe.Value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in mas) { CHelper.SafeMultipleSelect(lbGenCats, s); } break; case Project.ProjectCategoryTypeFilterKey: CHelper.SafeSelect(ddPrjCatType, fe.Value.ToString()); break; case Project.ProjectCategoriesFilterKey: string[] mas1 = fe.Value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in mas1) { CHelper.SafeMultipleSelect(lbPrjCats, s); } break; case Project.PortfolioTypeFilterKey: CHelper.SafeSelect(ddPrjGrpType, fe.Value.ToString()); break; case Project.PortfoliosFilterKey: string[] mas2 = fe.Value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in mas2) { CHelper.SafeMultipleSelect(lbPrjGrps, s); } break; case Project.MyParticipationOnlyFilterKey: chkOnlyForUser.Checked = bool.Parse(fe.Value.ToString()); break; default: break; } } #endregion }
private FilterElementCollection GetFilters() { FilterElementCollection fec = new FilterElementCollection(); if (ddSDType.SelectedValue != "0") { FilterElement fe = null; switch (ddSDType.SelectedValue) { case "1": fe = FilterElement.EqualElement(Project.StartDateFilterKey, dtcStartDate.SelectedDate.ToString(CultureInfo.InvariantCulture)); fe.Type = FilterElementType.GreaterOrEqual; break; case "2": fe = FilterElement.EqualElement(Project.StartDateFilterKey, dtcStartDate.SelectedDate.ToString(CultureInfo.InvariantCulture)); fe.Type = FilterElementType.LessOrEqual; break; case "3": fe = FilterElement.EqualElement(Project.StartDateFilterKey, dtcStartDate.SelectedDate.ToString(CultureInfo.InvariantCulture)); fe.Type = FilterElementType.Equal; break; default: break; } if (fe != null) { fec.Add(fe); } } if (ddFDType.SelectedValue != "0") { FilterElement fe = null; switch (ddFDType.SelectedValue) { case "1": fe = FilterElement.EqualElement(Project.EndDateFilterKey, dtcEndDate.SelectedDate.ToString(CultureInfo.InvariantCulture)); fe.Type = FilterElementType.GreaterOrEqual; break; case "2": fe = FilterElement.EqualElement(Project.EndDateFilterKey, dtcEndDate.SelectedDate.ToString(CultureInfo.InvariantCulture)); fe.Type = FilterElementType.LessOrEqual; break; case "3": fe = FilterElement.EqualElement(Project.EndDateFilterKey, dtcEndDate.SelectedDate.ToString(CultureInfo.InvariantCulture)); fe.Type = FilterElementType.Equal; break; default: break; } if (fe != null) { fec.Add(fe); } } if (ddStatus.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Project.StatusFilterKey, ddStatus.SelectedValue); fec.Add(fe); } if (ddPrjPhases.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Project.PhaseFilterKey, ddPrjPhases.SelectedValue); fec.Add(fe); } if (ddType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Project.TypeFilterKey, ddType.SelectedValue); fec.Add(fe); } if (ddManager.SelectedValue != "0") { if (ddManager.SelectedValue == "-5") //CurrentUser { FilterElement fe = FilterElement.EqualElement(Project.ManagerFilterKey, "{Security:CurrentUserId}"); fe.ValueIsTemplate = true; fec.Add(fe); } else { FilterElement fe = FilterElement.EqualElement(Project.ManagerFilterKey, ddManager.SelectedValue); fec.Add(fe); } } if (ddExeManager.SelectedValue != "0") { if (ddExeManager.SelectedValue == "-5") //CurrentUser { FilterElement fe = FilterElement.EqualElement(Project.ExecManagerFilterKey, "{Security:CurrentUserId}"); fe.ValueIsTemplate = true; fec.Add(fe); } else { FilterElement fe = FilterElement.EqualElement(Project.ExecManagerFilterKey, ddExeManager.SelectedValue); fec.Add(fe); } } if (ddPriority.SelectedValue != "-1") { FilterElement fe = FilterElement.EqualElement(Project.PriorityFilterKey, ddPriority.SelectedValue); fec.Add(fe); } // Portfolios if (ddPrjGrpType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Project.PortfolioTypeFilterKey, ddPrjGrpType.SelectedValue); fec.Add(fe); ArrayList alPrjGrps = new ArrayList(); foreach (ListItem liItem in lbPrjGrps.Items) { if (liItem.Selected && !alPrjGrps.Contains(liItem.Value)) { alPrjGrps.Add(liItem.Value); } } FilterElement fe1 = FilterElement.EqualElement(Project.PortfoliosFilterKey, String.Join(";", (string[])alPrjGrps.ToArray(typeof(string)))); fec.Add(fe1); } // General Categories if (ddGenCatType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Project.GenCategoryTypeFilterKey, ddGenCatType.SelectedValue); fec.Add(fe); ArrayList alGenCats = new ArrayList(); foreach (ListItem liItem in lbGenCats.Items) { if (liItem.Selected && !alGenCats.Contains(liItem.Value)) { alGenCats.Add(liItem.Value); } } FilterElement fe1 = FilterElement.EqualElement(Project.GenCategoriesFilterKey, String.Join(";", (string[])alGenCats.ToArray(typeof(string)))); fec.Add(fe1); } // Project Categories if (ddPrjCatType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Project.ProjectCategoryTypeFilterKey, ddPrjCatType.SelectedValue); fec.Add(fe); ArrayList alPrjCats = new ArrayList(); foreach (ListItem liItem in lbPrjCats.Items) { if (liItem.Selected && !alPrjCats.Contains(liItem.Value)) { alPrjCats.Add(liItem.Value); } } FilterElement fe1 = FilterElement.EqualElement(Project.ProjectCategoriesFilterKey, String.Join(";", (string[])alPrjCats.ToArray(typeof(string)))); fec.Add(fe1); } if (chkOnlyForUser.Checked) { FilterElement fe = FilterElement.EqualElement(Project.MyParticipationOnlyFilterKey, chkOnlyForUser.Checked.ToString()); fec.Add(fe); } //Client string client = ""; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { client = "org_" + ClientControl.ObjectId; } else if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { client = "contact_" + ClientControl.ObjectId; } if (!String.IsNullOrEmpty(client)) { FilterElement fe = FilterElement.EqualElement(Project.ClientFilterKey, client); fec.Add(fe); } return(fec); }
private void BindSavedValues() { ListViewProfile profile = ListViewProfile.Load(_className, _uid, String.Empty); CHelper.SafeSelect(ddFieldSets, profile.FieldSetName); CHelper.SafeSelect(ddGroupField, String.IsNullOrEmpty(profile.GroupByFieldName) ? Incident.AvailableGroupField.NotSet.ToString() : profile.GroupByFieldName); txtTitle.Text = profile.Name; cbIsPublic.Checked = profile.IsPublic; #region Filters FilterElementCollection fec = profile.Filters; foreach (FilterElement fe in fec) { switch (fe.Source) { case Incident.ProjectFilterKey: CHelper.SafeSelect(ddlProject, fe.Value.ToString()); break; case Incident.ManagerFilterKey: CHelper.SafeSelect(ddManager, fe.Value.ToString()); break; case Incident.ResponsibleFilterKey: CHelper.SafeSelect(ddResponsible, fe.Value.ToString()); break; case Incident.CreatorFilterKey: CHelper.SafeSelect(ddCreatedBy, fe.Value.ToString()); break; case Incident.PriorityFilterKey: CHelper.SafeSelect(ddPriority, fe.Value.ToString()); break; case Incident.IssueBoxFilterKey: CHelper.SafeSelect(ddIssBox, fe.Value.ToString()); break; case Incident.TypeFilterKey: CHelper.SafeSelect(ddType, fe.Value.ToString()); break; case Incident.ClientFilterKey: PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; Incident.GetContactId(fe.Value.ToString(), out orgUid, out contactUid); if (orgUid != PrimaryKeyId.Empty) { try { Mediachase.Ibn.Core.Business.BusinessManager.Load(OrganizationEntity.GetAssignedMetaClassName(), orgUid); ClientControl.ObjectId = orgUid; ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); } catch { } } else if (contactUid != PrimaryKeyId.Empty) { try { Mediachase.Ibn.Core.Business.BusinessManager.Load(ContactEntity.GetAssignedMetaClassName(), contactUid); ClientControl.ObjectId = contactUid; ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); } catch { } } break; case Incident.StatusFilterKey: CHelper.SafeSelect(ddState, fe.Value.ToString()); break; case Incident.SeverityFilterKey: CHelper.SafeSelect(ddSeverity, fe.Value.ToString()); break; case Incident.GenCategoryTypeFilterKey: CHelper.SafeSelect(ddGenCatType, fe.Value.ToString()); //todo - gen category filter view break; case Incident.GenCategoriesFilterKey: string[] mas = fe.Value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in mas) { CHelper.SafeMultipleSelect(lbGenCats, s); } //todo - gen category filter view break; case Incident.IssueCategoryTypeFilterKey: CHelper.SafeSelect(ddIssCatType, fe.Value.ToString()); //todo - gen category filter view break; case Incident.IssueCategoriesFilterKey: string[] mas1 = fe.Value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in mas1) { CHelper.SafeMultipleSelect(lbIssCats, s); } //todo - gen category filter view break; case Incident.UnansweredFilterKey: cbOnlyNewMess.Checked = bool.Parse(fe.Value.ToString()); break; case Incident.OverdueFilterKey: cbOnlyOverdue.Checked = bool.Parse(fe.Value.ToString()); break; default: break; } } #endregion }
private FilterElementCollection GetFilters() { FilterElementCollection fec = new FilterElementCollection(); if (cbOnlyNewMess.Checked) { FilterElement fe = FilterElement.EqualElement(Incident.UnansweredFilterKey, cbOnlyNewMess.Checked.ToString()); fec.Add(fe); } if (cbOnlyOverdue.Checked) { FilterElement fe = FilterElement.EqualElement(Incident.OverdueFilterKey, cbOnlyOverdue.Checked.ToString()); fec.Add(fe); } if (ddManager.SelectedValue != "0") { if (ddManager.SelectedValue == "-5") //CurrentUser { FilterElement fe = FilterElement.EqualElement(Incident.ManagerFilterKey, "{Security:CurrentUserId}"); fe.ValueIsTemplate = true; fec.Add(fe); } else { FilterElement fe = FilterElement.EqualElement(Incident.ManagerFilterKey, ddManager.SelectedValue); fec.Add(fe); } } if (ddResponsible.SelectedValue != "0") { if (ddResponsible.SelectedValue == "-5") //CurrentUser { FilterElement fe = FilterElement.EqualElement(Incident.ResponsibleFilterKey, "{Security:CurrentUserId}"); fe.ValueIsTemplate = true; fec.Add(fe); } else { FilterElement fe = FilterElement.EqualElement(Incident.ResponsibleFilterKey, ddResponsible.SelectedValue); fec.Add(fe); } } if (ddPriority.SelectedValue != "-1") { FilterElement fe = FilterElement.EqualElement(Incident.PriorityFilterKey, ddPriority.SelectedValue); fec.Add(fe); } if (ddIssBox.SelectedValue != "0" && _pc[IncidentListNew.IssueListViewNameKey] != Incident.FieldSetName.GroupByBox.ToString()) { FilterElement fe = FilterElement.EqualElement(Incident.IssueBoxFilterKey, ddIssBox.SelectedValue); fec.Add(fe); } if (ddType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Incident.TypeFilterKey, ddType.SelectedValue); fec.Add(fe); } if (ddlProject.SelectedValue != "0" && _pc[IncidentListNew.IssueListViewNameKey] != Incident.FieldSetName.GroupByProject.ToString()) { FilterElement fe = FilterElement.EqualElement(Incident.ProjectFilterKey, ddlProject.SelectedValue); fec.Add(fe); } if (ddCreatedBy.SelectedValue != "0") { if (ddCreatedBy.SelectedValue == "-5") //CurrentUser { FilterElement fe = FilterElement.EqualElement(Incident.CreatorFilterKey, "{Security:CurrentUserId}"); fe.ValueIsTemplate = true; fec.Add(fe); } else { FilterElement fe = FilterElement.EqualElement(Incident.CreatorFilterKey, ddCreatedBy.SelectedValue); fec.Add(fe); } } if (ddState.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Incident.StatusFilterKey, ddState.SelectedValue); fec.Add(fe); } if (ddSeverity.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Incident.SeverityFilterKey, ddSeverity.SelectedValue); fec.Add(fe); } //Client string client = ""; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { client = "org_" + ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName() && ClientControl.ObjectId != PrimaryKeyId.Empty) { client = "contact_" + ClientControl.ObjectId; } if (!String.IsNullOrEmpty(client) && _pc[IncidentListNew.IssueListViewNameKey] != Incident.FieldSetName.GroupByClient.ToString()) { FilterElement fe = FilterElement.EqualElement(Incident.ClientFilterKey, client); fec.Add(fe); } // General Categories if (ddGenCatType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Incident.GenCategoryTypeFilterKey, ddGenCatType.SelectedValue); fec.Add(fe); ArrayList alGenCats = new ArrayList(); foreach (ListItem liItem in lbGenCats.Items) { if (liItem.Selected && !alGenCats.Contains(liItem.Value)) { alGenCats.Add(liItem.Value); } } FilterElement fe1 = FilterElement.EqualElement(Incident.GenCategoriesFilterKey, String.Join(";", (string[])alGenCats.ToArray(typeof(string)))); fec.Add(fe1); } // Issue Categories if (ddIssCatType.SelectedValue != "0") { FilterElement fe = FilterElement.EqualElement(Incident.IssueCategoryTypeFilterKey, ddIssCatType.SelectedValue); fec.Add(fe); ArrayList alIssCats = new ArrayList(); foreach (ListItem liItem in lbIssCats.Items) { if (liItem.Selected && !alIssCats.Contains(liItem.Value)) { alIssCats.Add(liItem.Value); } } FilterElement fe1 = FilterElement.EqualElement(Incident.IssueCategoriesFilterKey, String.Join(";", (string[])alIssCats.ToArray(typeof(string)))); fec.Add(fe1); } return(fec); }
private void BindInfoTable() { int rowCount = 0; tblFilterInfoSet.Rows.Clear(); // Status if (Request.QueryString["DocStatus"] != null) { ListItem li = ddStatus.Items.FindByValue(Request.QueryString["DocStatus"]); if (li != null && li.Value != "0") { AddRow( String.Format("{0}: ", LocRM.GetString("Status")), String.Format("<span style='color:red'>{0}</span>", li.Text)); } } else if (_pc[_strPref + "DocumentList_Status"] != null) { ListItem li = ddStatus.Items.FindByValue(_pc[_strPref + "DocumentList_Status"]); if (li != null && li.Value != "0") { AddRow(String.Format("{0}: ", LocRM.GetString("Status")), li.Text); rowCount++; } } // Manager if (Request.QueryString["ManDoc"] != null) { ListItem li = ddManager.Items.FindByValue(Security.CurrentUser.UserID.ToString()); if (li != null && li.Value != "-1") { AddRow( String.Format("{0}: ", LocRM.GetString("Manager")), String.Format("<span style='color:red'>{0}</span>", li.Text)); } } else if (_pc[_strPref + "DocumentList_Manager"] != null) { ListItem li = ddManager.Items.FindByValue(_pc[_strPref + "DocumentList_Manager"]); if (li != null && li.Value != "0") { AddRow(String.Format("{0}: ", LocRM.GetString("Manager")), li.Text); rowCount++; } } //Resource if (Request.QueryString["AssDoc"] != null) { AddRow(String.Format("{0}: ", LocRM.GetString("tMyRole")), String.Format("<span style='color:red'>{0}</span>", LocRM.GetString("tResource"))); } // Project if (ProjectID > 0) { AddRow( String.Format("{0}: ", LocRM.GetString("Project")), String.Format("<span style='color:red'>{0}</span>", Project.GetProjectTitle(ProjectID))); } else if (_pc[_strPref + "DocumentList_Project"] != null) { ListItem li = ddlProject.Items.FindByValue(_pc[_strPref + "DocumentList_Project"]); if (li != null && li.Value != "0") { AddRow(String.Format("{0}: ", LocRM.GetString("Project")), li.Text); rowCount++; } } // Priority if (Request.QueryString["DocPrty"] != null) { ListItem li = ddPriority.Items.FindByValue(Request.QueryString["DocPrty"]); if (li != null && li.Value != "-1") { AddRow( String.Format("{0}: ", LocRM.GetString("Priority")), String.Format("<span style='color:red'>{0}</span>", li.Text)); } } else if (_pc[_strPref + "DocumentList_Priority"] != null) { ListItem li = ddPriority.Items.FindByValue(_pc[_strPref + "DocumentList_Priority"]); if (li != null && li.Value != "-1") { AddRow(String.Format("{0}: ", LocRM.GetString("Priority")), li.Text); rowCount++; } } //Client if (_pc[_strPref + "DocumentList_ClientNew"] != null) { string ss = _pc[_strPref + "DocumentList_ClientNew"]; if (ss.IndexOf("_") >= 0) { string stype = ss.Substring(0, ss.IndexOf("_")); string sName = ""; if (stype.ToLower() == "org") { EntityObject entity = BusinessManager.Load(OrganizationEntity.GetAssignedMetaClassName(), PrimaryKeyId.Parse(ss.Substring(ss.IndexOf("_") + 1))); if (entity != null) { sName = ((OrganizationEntity)entity).Name; } AddRow(String.Format("{0}: ", LocRM2.GetString("Client")), sName); rowCount++; } else if (stype.ToLower() == "contact") { EntityObject entity = BusinessManager.Load(ContactEntity.GetAssignedMetaClassName(), PrimaryKeyId.Parse(ss.Substring(ss.IndexOf("_") + 1))); if (entity != null) { sName = ((ContactEntity)entity).FullName; } AddRow(String.Format("{0}: ", LocRM2.GetString("Client")), sName); rowCount++; } } } // Keyword if (_pc[_strPref + "DocumentList_Keyword"] != null && _pc[_strPref + "DocumentList_Keyword"] != "") { AddRow( String.Format("{0}: ", LocRM.GetString("Keyword")), String.Format("'{0}'", _pc[_strPref + "DocumentList_Keyword"])); rowCount++; } // General Categories if (Request.QueryString["GenCat"] != null) { ListItem li = lbGenCats.Items.FindByValue(Request.QueryString["GenCat"]); if (li != null) { AddRow( String.Format("{0}: ", LocRM.GetString("Category")), String.Format("<span style='color:red'>{0}</span>", li.Text)); } } else { if (_pc[_strPref + "DocumentList_GenCatType"] != null) { ListItem li = ddGenCatType.Items.FindByValue(_pc[_strPref + "DocumentList_GenCatType"]); if (li != null && li.Value != "0") { string str = ""; foreach (ListItem item in lbGenCats.Items) { if (item.Selected) { if (str != "") { str += ", "; } str += item.Text; } } if (li.Value == "2") { AddRow(String.Format("{0} ({1}): ", LocRM.GetString("Category"), li.Text), str); } else { AddRow(String.Format("{0}: ", LocRM.GetString("Category")), str); } rowCount++; } } } if (rowCount > 0) { lblFilterNotSet.Visible = false; btnReset2.Visible = true; } else { lblFilterNotSet.Visible = true; btnReset2.Visible = false; } // Grouping if (Request.QueryString["DocGroup"] != null) { if (Request.QueryString["IssGroup"] == "Prj") { lblGroupInfo.Text = "<table><tr><td class='text' width='120px' align='right'>" + LocRM.GetString("tGroupBy") + ": " + "</td><td class='text'><font color='red'>" + LocRM.GetString("tProjects") + "</font></td></tr></table>"; btnReset3.Visible = false; } if (Request.QueryString["IssGroup"] == "Client") { lblGroupInfo.Text = "<table><tr><td class='text' width='120px' align='right'>" + LocRM.GetString("tGroupBy") + ": " + "</td><td class='text'><font color='red'>" + LocRM.GetString("tClients") + "</font></td></tr></table>"; btnReset3.Visible = false; } } else if (_pc[_strPref + "ShowDocumentGroup"] != null && bool.Parse(_pc[_strPref + "ShowDocumentGroup"])) { btnReset3.Visible = true; } }
private void BindSavedValues() { //Manager if (_pc[_strPref + "DocumentList_Manager"] != null) { CommonHelper.SafeSelect(ddManager, _pc[_strPref + "DocumentList_Manager"]); } //Priority if (_pc[_strPref + "DocumentList_Priority"] != null) { CommonHelper.SafeSelect(ddPriority, _pc[_strPref + "DocumentList_Priority"]); } //Keyword if (_pc[_strPref + "DocumentList_Keyword"] != null) { tbKeyword.Text = _pc[_strPref + "DocumentList_Keyword"]; } //Project if (_pc[_strPref + "DocumentList_Project"] != null) { CommonHelper.SafeSelect(ddlProject, _pc[_strPref + "DocumentList_Project"]); } //Status if (_pc[_strPref + "DocumentList_Status"] != null) { CommonHelper.SafeSelect(ddStatus, _pc[_strPref + "DocumentList_Status"]); } //Client if (_pc[_strPref + "DocumentList_ClientNew"] != null && (!Page.IsPostBack || ClientControl.ObjectId == PrimaryKeyId.Empty)) { string ss = _pc[_strPref + "DocumentList_ClientNew"]; if (ss.IndexOf("_") >= 0) { string stype = ss.Substring(0, ss.IndexOf("_")); if (stype.ToLower() == "org") { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = PrimaryKeyId.Parse(ss.Substring(ss.IndexOf("_") + 1)); } else if (stype.ToLower() == "contact") { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = PrimaryKeyId.Parse(ss.Substring(ss.IndexOf("_") + 1)); } else { ClientControl.ObjectType = String.Empty; ClientControl.ObjectId = PrimaryKeyId.Empty; } } } // General Categories if (_pc[_strPref + "DocumentList_GenCatType"] != null) { CommonHelper.SafeSelect(ddGenCatType, _pc[_strPref + "DocumentList_GenCatType"]); } if (ddGenCatType.SelectedItem.Value == "0") { lbGenCats.Style["Display"] = "none"; } else { lbGenCats.Style["Display"] = "block"; } using (IDataReader reader = Document.GetListCategoriesByUser()) { while (reader.Read()) { CommonHelper.SafeMultipleSelect(lbGenCats, reader["CategoryId"].ToString()); } } }
private DataTable BindDataGrid(DataGrid dg) { _hash.Clear(); #region Filter Params int projId = ProjectID; //Project if (ProjectID == 0) { projId = int.Parse(ddlProject.SelectedValue); } //Manager int manId = 0; if (Request.QueryString["ManDoc"] != null) { manId = Security.CurrentUser.UserID; } manId = int.Parse(ddManager.SelectedValue); //Resource int resId = 0; if (Request.QueryString["AssDoc"] != null) { resId = Security.CurrentUser.UserID; } //Keyword string keyword = tbKeyword.Text; // Priority int priority_id = 0; if (Request.QueryString["DocPrty"] != null) { priority_id = int.Parse(Request.QueryString["DocPrty"]); } else if (ddPriority.SelectedItem != null) { priority_id = int.Parse(ddPriority.SelectedValue); } // Status int status_id = 0; if (Request.QueryString["DocStatus"] != null) { status_id = int.Parse(Request.QueryString["DocStatus"]); } else if (ddStatus.SelectedItem != null) { status_id = int.Parse(ddStatus.SelectedValue); } // General Category Type int genCategory_type = 0; if (Request.QueryString["GenCat"] != null) { genCategory_type = -int.Parse(Request.QueryString["GenCat"]); } else if (ddGenCatType.SelectedItem != null) { genCategory_type = int.Parse(ddGenCatType.SelectedValue); } // Client PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName()) { orgUid = ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName()) { contactUid = ClientControl.ObjectId; } #endregion DataTable dt = new DataTable(); DataView dv = new DataView(); if ((_pc[_strPref + "ShowDocumentGroup"] != null && bool.Parse(_pc[_strPref + "ShowDocumentGroup"])) || (Request.QueryString["DocGroup"] != null && Request.QueryString["DocGroup"] == "Prj")) { dt = Document.GetListDocumentsByFilterGroupedByProject(projId, manId, resId, priority_id, status_id, keyword, genCategory_type, orgUid, contactUid); dv = dt.DefaultView; } else if ((_pc[_strPref + "ShowDocumentGroup"] != null && bool.Parse(_pc[_strPref + "ShowDocumentGroup"])) || (Request.QueryString["DocGroup"] != null && Request.QueryString["DocGroup"] == "Client")) { dt = Document.GetListDocumentsByFilterGroupedByClient(projId, manId, resId, priority_id, status_id, keyword, genCategory_type, orgUid, contactUid); dv = dt.DefaultView; } else { dt = Document.GetListDocumentsByFilterDataTable(projId, manId, resId, priority_id, status_id, keyword, genCategory_type, contactUid, orgUid); dv = dt.DefaultView; if (_pc[_strPref + "DocumentList_SortColumn"] == null) { _pc[_strPref + "DocumentList_SortColumn"] = "CreationDate DESC"; } try { dv.Sort = _pc[_strPref + "DocumentList_SortColumn"]; } catch { } } dg.DataSource = dv; if (_pc[_strPref + "DocumentList_PageSize"] != null) { dg.PageSize = int.Parse(_pc[_strPref + "DocumentList_PageSize"]); } if (_pc[_strPref + "DocumentList_Page"] != null) { int pageIndex = int.Parse(_pc[_strPref + "DocumentList_Page"]); int ppi = dv.Count / dg.PageSize; if (dv.Count % dg.PageSize == 0) { ppi = ppi - 1; } if (pageIndex <= ppi) { dg.CurrentPageIndex = pageIndex; } else { dg.CurrentPageIndex = 0; } } dg.DataBind(); return(dt); }
private void BindDropDowns() { ddFilter.Items.Clear(); ddFilter.Items.Add(new ListItem(CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName("Principal").FriendlyName), Principal.GetAssignedMetaClass().Name)); ddFilter.Items.Add(new ListItem(CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName("Organization").FriendlyName), OrganizationEntity.GetAssignedMetaClassName())); ddFilter.Items.Add(new ListItem(CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName("Contact").FriendlyName), ContactEntity.GetAssignedMetaClassName())); if (_pc[_key] == null) { _pc[_key] = "Principal"; } CHelper.SafeSelect(ddFilter, _pc[_key]); }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { Page.Validate(); if (!Page.IsValid) { return; } string sGroups = iGroups.Value; ArrayList alGroups = new ArrayList(); while (sGroups.Length > 0) { alGroups.Add(Int32.Parse(sGroups.Substring(0, sGroups.IndexOf(",")))); sGroups = sGroups.Remove(0, sGroups.IndexOf(",") + 1); } // Client PrimaryKeyId orgUid = PrimaryKeyId.Empty; PrimaryKeyId contactUid = PrimaryKeyId.Empty; if (ClientControl.ObjectType == OrganizationEntity.GetAssignedMetaClassName()) { orgUid = ClientControl.ObjectId; } else if (ClientControl.ObjectType == ContactEntity.GetAssignedMetaClassName()) { contactUid = ClientControl.ObjectId; } if (edit == "1") { if (groupId == (int)InternalSecureGroups.Partner || SecureGroup.IsPartner(groupId)) { SecureGroup.UpdatePartner(groupId, contactUid, orgUid, tbGroupTitle.Text, alGroups); } else { SecureGroup.UpdateGroup(groupId, tbGroupTitle.Text); } Response.Redirect("../Directory/Directory.aspx?Tab=0&SGroupID=" + groupId.ToString()); } else { int newGroupId = 1; if (groupId == (int)InternalSecureGroups.Partner || SecureGroup.IsPartner(groupId)) { byte[] groupLogo = null; FileInfo fi = new FileInfo(Server.MapPath(GlobalResourceManager.Strings["IMGroupLogoUrl"])); FileStream fs = fi.OpenRead(); groupLogo = new byte[fi.Length]; int nBytesRead = fs.Read(groupLogo, 0, (int)fi.Length); newGroupId = SecureGroup.CreatePartner(tbGroupTitle.Text, contactUid, orgUid, alGroups, groupLogo); } else { newGroupId = SecureGroup.Create(groupId, tbGroupTitle.Text); } Response.Redirect("../Directory/Directory.aspx?Tab=0"); } }