示例#1
0
        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>");
            }
        }
示例#2
0
        /// <summary>
        /// Default data bind.
        /// </summary>
        private void PreBindSteps()
        {
            rbSourceType.Items.Add(new ListItem(" " + GetGlobalResourceObject("IbnFramework.Common", "imExcel").ToString(), "0"));
            rbSourceType.Items.Add(new ListItem(" " + GetGlobalResourceObject("IbnFramework.Common", "imXML").ToString(), "1"));
            rbSourceType.Items.Add(new ListItem(" " + GetGlobalResourceObject("IbnFramework.Common", "imCSV").ToString(), "2"));
            if (String.Compare(_className, ContactEntity.GetAssignedMetaClassName(), true) == 0)
            {
                rbSourceType.Items.Add(new ListItem(" " + GetGlobalResourceObject("IbnFramework.Common", "imVCF").ToString(), "3"));
            }

            CHelper.SafeSelect(rbSourceType, "0");

            ddDelimeter.Items.Add(new ListItem(",", ","));
            ddDelimeter.Items.Add(new ListItem(".", "."));
            ddDelimeter.Items.Add(new ListItem(";", ";"));
            ddDelimeter.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.Common", "tSpaceValue").ToString(), "space"));
            ddDelimeter.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.Common", "tTabValue").ToString(), "tab"));

            ddTextQualifier.Items.Add(new ListItem("\"", "\""));
            ddTextQualifier.Items.Add(new ListItem("'", "'"));

            ddEncoding.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.Common", "tDefault").ToString(), "Default"));
            ddEncoding.Items.Add(new ListItem("ASCII", "ASCII"));
            ddEncoding.Items.Add(new ListItem("UTF-8", "UTF8"));
            ddEncoding.Items.Add(new ListItem("Unicode", "Unicode"));
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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;
        }
示例#5
0
        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;
                    }
                }
            }
        }
示例#6
0
        private static void InsertContactDictionaryItemList(XmlNode ownerNode, string GroupName)
        {
            XmlNode xmlNewRootNode = ownerNode.OwnerDocument.CreateElement(GroupName);

            EntityObject[] list = BusinessManager.List(ContactEntity.GetAssignedMetaClassName(), null,
                                                       new Mediachase.Ibn.Data.SortingElement[] { Mediachase.Ibn.Data.SortingElement.Ascending("FullName") });

            foreach (ContactEntity contact in list)
            {
                InsertDictionaryItem(xmlNewRootNode, contact.FullName, contact.PrimaryKeyId.ToString());
            }
            ownerNode.AppendChild(xmlNewRootNode);
        }
示例#7
0
        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>");
        }
示例#8
0
        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;
        }
示例#9
0
        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"]);

                if (selectedElements != null)
                {
                    string className  = ContactEntity.GetAssignedMetaClassName();
                    int    errorCount = 0;

                    foreach (string elem in selectedElements)
                    {
                        string       id  = elem.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0];
                        PrimaryKeyId key = PrimaryKeyId.Parse(id);

                        using (TransactionScope tran = DataContext.Current.BeginTransaction())
                        {
                            bool wasError = false;
                            try
                            {
                                BusinessManager.Delete(className, key);
                            }
                            catch (Exception ex)
                            {
                                wasError = true;
                                CHelper.GenerateErrorReport(ex);
                                errorCount++;
                            }

                            if (!wasError)
                            {
                                tran.Commit();
                            }
                        }
                    }

                    if (errorCount > 0)
                    {
                        ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:NotAllSelectedItemsWereProcessed}");
                    }

                    CHelper.RequireBindGrid();
                }
            }
        }
示例#10
0
        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;
        }
示例#11
0
        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);
        }
示例#12
0
 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"] = "_";
     }
 }
示例#13
0
        private void BindDGContacts(string keyword)
        {
            FilterElement           fe  = CHelper.GetSearchFilterElementByKeyword(keyword, ContactEntity.GetAssignedMetaClassName());
            FilterElementCollection fec = new FilterElementCollection();

            fec.Add(fe);


            dgContacts.DataSource = BusinessManager.List(ContactEntity.GetAssignedMetaClassName(), fec.ToArray());
            dgContacts.DataBind();

            int RowCount = dgContacts.Items.Count;

            if (RowCount == 0)
            {
                Sep12.Visible = false;
                Pan12.Visible = false;
            }
            else
            {
                Sep12.Title = String.Format("{0} ({1})", LocRM.GetString("Contacts"), RowCount);
            }
        }
示例#14
0
        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();
        }
示例#15
0
        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
        }
示例#16
0
        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);
        }
示例#17
0
        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
        }
示例#18
0
        protected void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }
            bool valid = true;

            txtTitle.Text       = HttpUtility.HtmlEncode(txtTitle.Text);
            ftbDescription.Text = HttpUtility.HtmlEncode(ftbDescription.Text);

            int iProjectId = ProjectId;

            if (ucProject.Visible)
            {
                iProjectId = ucProject.ObjectId;
            }

            TimeSpan ts      = new TimeSpan(ucTaskTime.Value.Ticks);
            int      Minutes = (int)ts.TotalMinutes;

            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));
                }
            }

            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 (DocumentId > 0)
            {
                Mediachase.IBN.Business.Document2.Update(DocumentId, txtTitle.Text, ftbDescription.Text,
                                                         int.Parse(ddlPriority.SelectedItem.Value),
                                                         int.Parse(ddlManager.SelectedItem.Value),
                                                         Minutes, alCategories,
                                                         ContactUid, OrgUid);
            }
            else
            {
                if (rbFile.Checked && fAssetFile.PostedFile != null && fAssetFile.PostedFile.ContentLength > 0)
                {
                    DocumentId = Document.Create(txtTitle.Text, ftbDescription.Text, iProjectId,
                                                 int.Parse(ddlPriority.SelectedItem.Value),
                                                 int.Parse(ddlManager.SelectedItem.Value),
                                                 1, Minutes,
                                                 alCategories, fAssetFile.PostedFile.FileName, fAssetFile.PostedFile.InputStream,
                                                 ContactUid, OrgUid);
                }
                else if (rbHTML.Checked && fckEditor.Text != null && fckEditor.Text != String.Empty)
                {
                    MemoryStream memStream = new MemoryStream();
                    StreamWriter writer    = new StreamWriter(memStream);
                    writer.Write(fckEditor.Text);
                    writer.Flush();
                    memStream.Seek(0, SeekOrigin.Begin);
                    String title = String.Empty;
                    if (tbHtmlFileTitle.Text != String.Empty)
                    {
                        title = tbHtmlFileTitle.Text;
                    }
                    else
                    {
                        title = "HTML Attachment";
                    }
                    string html_filename = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title);
                    html_filename = String.Concat(html_filename, ".html");

                    DocumentId = Document.Create(txtTitle.Text, ftbDescription.Text, iProjectId,
                                                 int.Parse(ddlPriority.SelectedItem.Value),
                                                 int.Parse(ddlManager.SelectedItem.Value),
                                                 1, Minutes,
                                                 alCategories, html_filename, memStream, ContactUid, OrgUid);
                }
                else if (rbLink.Checked && tbLink.Text != String.Empty)
                {
                    string       data      = string.Format("[InternetShortcut]\r\nURL={0}", tbLink.Text);
                    MemoryStream memStream = new MemoryStream();
                    StreamWriter writer    = new StreamWriter(memStream, Encoding.Unicode);
                    writer.Write(data);
                    writer.Flush();
                    memStream.Seek(0, SeekOrigin.Begin);
                    string title         = tbLinkTitle.Text;
                    string html_filename = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title);
                    if (html_filename.IndexOf(".url") < 0)
                    {
                        html_filename += ".url";
                    }
                    DocumentId = Document.Create(txtTitle.Text, ftbDescription.Text, iProjectId,
                                                 int.Parse(ddlPriority.SelectedItem.Value),
                                                 int.Parse(ddlManager.SelectedItem.Value),
                                                 1, Minutes,
                                                 alCategories, html_filename, memStream, ContactUid, OrgUid);
                }
                else if (fAssetFile.PostedFile == null)
                {
                    DocumentId = Document.Create(txtTitle.Text, ftbDescription.Text, iProjectId,
                                                 int.Parse(ddlPriority.SelectedItem.Value),
                                                 int.Parse(ddlManager.SelectedItem.Value),
                                                 1, Minutes,
                                                 alCategories, null, null, ContactUid, OrgUid);
                }
                else
                {
                    vFile.Visible = true;
                    valid         = false;
                }
            }
            if (DocumentId != 0 && valid)
            {
                EditControl.Save(DocumentId);

                if (cbOneMore.Checked)
                {
                    if (ProjectId > 0)
                    {
                        Response.Redirect("~/Documents/DocumentEdit.aspx?Checked=1&ProjectId=" + ProjectId);
                    }
                    else
                    {
                        Response.Redirect("~/Documents/DocumentEdit.aspx?Checked=1");
                    }
                }
                else
                {
                    Response.Redirect("~/Documents/DocumentView.aspx?DocumentId=" + DocumentId);
                }
            }
        }
示例#19
0
        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);
                }
            }
        }
示例#20
0
        private void BindSavedValues()
        {
            int managerId = -1;
            int projectId = ProjectId;

            if (DocumentId > 0)
            {
                using (IDataReader reader = Document.GetDocument(DocumentId))
                {
                    if (reader.Read())
                    {
                        if (reader["ProjectTitle"] != DBNull.Value)
                        {
                            lblProject.Text = reader["ProjectTitle"].ToString();
                        }
                        else
                        {
                            lblProject.Text = LocRM.GetString("ProjectNotSet");
                        }

                        Util.CommonHelper.SafeSelect(ddlPriority, reader["PriorityId"].ToString());
                        //					Util.CommonHelper.SafeSelect(ddlStatus, reader["StatusId"].ToString());

                        txtTitle.Text       = HttpUtility.HtmlDecode(reader["Title"].ToString());
                        ftbDescription.Text = HttpUtility.HtmlDecode(reader["Description"].ToString());

                        ucTaskTime.Value = DateTime.MinValue.AddMinutes((int)reader["TaskTime"]);

                        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());
                        }

                        managerId = (int)reader["ManagerId"];

                        if (reader["ProjectId"] != DBNull.Value)
                        {
                            projectId = (int)reader["ProjectId"];
                        }
                    }
                }

                using (IDataReader reader = Document.GetListCategories(DocumentId))
                {
                    while (reader.Read())
                    {
                        for (int i = 0; i < lbCategory.Items.Count; i++)
                        {
                            Util.CommonHelper.SafeMultipleSelect(lbCategory, reader["CategoryId"].ToString());
                        }
                    }
                }

                EditControl.ObjectId = DocumentId;
                EditControl.BindData();
            }

            if (projectId > 0)
            {
                FillManagersByProject(projectId);
            }
            else
            {
                FillManagers();
            }

            // Select current manager
            if (managerId <= 0)
            {
                managerId = Security.CurrentUser.UserID;
            }

            ListItem managerItem = ddlManager.Items.FindByValue(managerId.ToString());

            if (managerItem == null)
            {
                UserLight ul = UserLight.Load(managerId);
                ddlManager.Items.Add(new ListItem(ul.LastName + " " + ul.FirstName, managerId.ToString()));
            }
            CommonHelper.SafeSelect(ddlManager, managerId.ToString());
        }
示例#21
0
        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);
            }
        }
示例#22
0
        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}:&nbsp; ", 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}:&nbsp; ", 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}:&nbsp; ", 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}:&nbsp; ", LocRM.GetString("Manager")), li.Text);
                    rowCount++;
                }
            }

            //Resource
            if (Request.QueryString["AssDoc"] != null)
            {
                AddRow(String.Format("{0}:&nbsp; ", LocRM.GetString("tMyRole")),
                       String.Format("<span style='color:red'>{0}</span>", LocRM.GetString("tResource")));
            }

            // Project
            if (ProjectID > 0)
            {
                AddRow(
                    String.Format("{0}:&nbsp; ", 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}:&nbsp; ", 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}:&nbsp; ", 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}:&nbsp; ", 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}:&nbsp; ", 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}:&nbsp; ", LocRM2.GetString("Client")), sName);
                        rowCount++;
                    }
                }
            }

            // Keyword
            if (_pc[_strPref + "DocumentList_Keyword"] != null && _pc[_strPref + "DocumentList_Keyword"] != "")
            {
                AddRow(
                    String.Format("{0}:&nbsp; ", 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}:&nbsp; ", 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}):&nbsp; ", LocRM.GetString("Category"), li.Text), str);
                        }
                        else
                        {
                            AddRow(String.Format("{0}:&nbsp; ", 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") + ":&nbsp;" + "</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") + ":&nbsp;" + "</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;
            }
        }
示例#23
0
        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]);
        }
示例#24
0
        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);
        }
示例#25
0
        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;
        }
示例#26
0
        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");
            }
        }
示例#27
0
        private void ConvertContacts(string companyLocale, Dictionary <int, OrganizationEntity> organizationsById, Dictionary <int, ContactEntity> contactsById)
        {
            Dictionary <string, OrganizationEntity> organizationsByName = new Dictionary <string, OrganizationEntity>();

            if (organizationsById != null && organizationsByName != null)
            {
                foreach (OrganizationEntity organization in organizationsById.Values)
                {
                    organizationsByName.Add(organization.Name, organization);
                }
            }

            Regex urlValidator = new Regex("^[\\w-_./:\\?&=]+");

            foreach (VCard vcard in VCard.List())
            {
                int vcardId = vcard.VCardId;

                ContactEntity contact = BusinessManager.InitializeEntity <ContactEntity>(ContactEntity.GetAssignedMetaClassName());

                SafelySetStringProperty(contact, "FullName", vcard.FullName);
                SafelySetStringProperty(contact, "NickName", vcard.NickName);
                if (!string.IsNullOrEmpty(vcard.Url) && urlValidator.IsMatch(vcard.Url))
                {
                    SafelySetStringProperty(contact, "WebSiteUrl", vcard.Url);
                }
                if (vcard.Birthday != DateTime.MinValue)
                {
                    contact.BirthDate = vcard.Birthday;
                }
                SafelySetStringProperty(contact, "JobTitle", vcard.Title);
                SafelySetStringProperty(contact, "Role", vcard.Role);
                SafelySetStringProperty(contact, "Description", vcard.Description);
                contact.Gender = ConvertGender(vcard.Gender);

                ConvertVCardName(vcardId, contact);
                ConvertVCardAddress(vcardId, contact, companyLocale);
                ConvertVCardPhones(vcardId, contact);
                ConvertVCardEmails(vcardId, contact);
                ConvertVCardOrganization(vcard, contact, organizationsById, organizationsByName);

                // Save contact
                contact.PrimaryKeyId = BusinessManager.Create(contact);

                contactsById.Add(vcardId, contact);
            }
        }
示例#28
0
        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());
                }
            }
        }
示例#29
0
        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;
                    }
                }
            }
        }
示例#30
0
        private DataTable BindDataGrid(DataGrid dg)
        {
            _hash.Clear();

            //Project
            int prjId = int.Parse(ddlProject.SelectedValue);

            //Manager
            int manId = int.Parse(ddManager.SelectedValue);

            //Resource
            int resId = 0;

            //Keyword
            string keyword = tbKeyword.Text;

            // Priority
            int priority_id = int.Parse(ddPriority.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;
            }

            // General Category Type
            int genCategory_type = int.Parse(ddGenCatType.SelectedValue);

            DataTable dt = ToDo.GetListTodoByFilterGroupedByClient(prjId, manId,
                                                                   resId, priority_id, keyword, genCategory_type, orgUid, contactUid);

            DataView dv = dt.DefaultView;

            dg.DataSource = dv;

            if (_pc[_strPref + "PageSize"] != null)
            {
                dg.PageSize = int.Parse(_pc[_strPref + "PageSize"]);
            }

            if (_pc[_strPref + "Page"] != null)
            {
                int pageIndex = int.Parse(_pc[_strPref + "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);
        }