Example #1
0
        public static int CreatePartner(string name, PrimaryKeyId contactUid, PrimaryKeyId orgUid, ArrayList VisibleGroups, byte[] IMGroupLogo)
        {
            if (!Security.IsUserInGroup(InternalSecureGroups.Administrator))
            {
                throw new AccessDeniedException();
            }

            int PartnerId = -1;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                PartnerId = DBGroup.Create((int)InternalSecureGroups.Partner, name);
                foreach (int GroupId in VisibleGroups)
                {
                    DBGroup.AddPartnerGroup(PartnerId, GroupId);
                }

                int IMGroupId = IMGroup.Create(name, "2B6087", true, IMGroupLogo, new ArrayList(), new ArrayList());

                DBGroup.UpdateIMGroupId(PartnerId, IMGroupId);
                DBGroup.UpdateClient(PartnerId, contactUid, orgUid);

                tran.Commit();
            }

            return(PartnerId);
        }
Example #2
0
        // Batch
        #region Update
        public static void Update(
            int eventId,
            string title,
            string description,
            string location,
            int projectId,
            int managerId,
            int priorityId,
            int typeId,
            DateTime startDate,
            DateTime finishDate,
            ArrayList categories,
            PrimaryKeyId contactUid,
            PrimaryKeyId orgUid)
        {
            VerifyCanUpdate(eventId);

            using (DbTransaction tran = DbTransaction.Begin())
            {
                UpdateGeneralInfo(eventId, typeId, title, description, location, false);
                UpdateProjectAndManager(eventId, projectId, managerId);
                UpdatePriority(eventId, priorityId, false);
                UpdateTimeline(eventId, startDate, finishDate, false);
                UpdateCategories(ListAction.Set, eventId, categories, false);
                UpdateClient(eventId, contactUid, orgUid, false);

                tran.Commit();
            }
        }
Example #3
0
        public static void Update(
			int eventId,
			string title,
			string description,
			string location,
			int projectId,
			int managerId,
			int priorityId,
			int typeId,
			DateTime startDate, 
			DateTime finishDate,
			ArrayList categories,
			PrimaryKeyId contactUid,
			PrimaryKeyId orgUid)
        {
            VerifyCanUpdate(eventId);

            using(DbTransaction tran = DbTransaction.Begin())
            {
                UpdateGeneralInfo(eventId, typeId, title, description, location, false);
                UpdateProjectAndManager(eventId, projectId, managerId);
                UpdatePriority(eventId, priorityId, false);
                UpdateTimeline(eventId, startDate, finishDate, false);
                UpdateCategories(ListAction.Set, eventId, categories, false);
                UpdateClient(eventId, contactUid, orgUid, false);

                tran.Commit();
            }
        }
Example #4
0
        public void Invoke(object Sender, object Element)
        {
            object objectid        = CHelper.GetFromContext("ObjectId");
            object classNameObject = CHelper.GetFromContext("ClassName");

            if (objectid != null && classNameObject != null)
            {
                PrimaryKeyId key       = (PrimaryKeyId)objectid;
                string       className = (string)classNameObject;

                int errorCount = 0;
                try
                {
                    BusinessManager.Delete(className, key);
                }
                catch (Exception ex)
                {
                    CHelper.GenerateErrorReport(ex);
                    errorCount++;
                }

                if (errorCount > 0)
                {
                    ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:ActionWasNotProcessed}");
                }
                else
                {
                    ((Control)Sender).Page.Response.Redirect(CHelper.GetLinkEntityList(className));
                }
            }
        }
Example #5
0
        protected override void PostCreateInsideTransaction(BusinessContext context)
        {
            // Call Base method
            base.PostCreateInsideTransaction(context);

            #region Create a new Document Card
            PrimaryKeyId pkDocumentType = ((CreateResponse)context.Response).PrimaryKeyId;

            // Create a new Document Card
            using (MetaClassManagerEditScope scope = DataContext.Current.MetaModel.BeginEdit())
            {
                // TODO: Check Card Name
                string cardName         = context.Request.Target["Name"].ToString();
                string cardFriendlyName = context.Request.Target["FriendlyName"].ToString();
                string cardPluralName   = cardFriendlyName;
                string tableName        = "cls_Document_" + context.Request.Target["Name"].ToString();

                MetaClass newCard = DataContext.Current.MetaModel.CreateCardMetaClass(DataContext.Current.GetMetaClass(DocumentEntity.GetAssignedMetaClassName()),
                                                                                      cardName, cardFriendlyName,
                                                                                      cardPluralName, tableName);

                scope.SaveChanges();
            }
            #endregion
        }
Example #6
0
        protected void lbAddItems_Click(object sender, EventArgs e)
        {
            string s = Request["__EVENTARGUMENT"];

            if (!String.IsNullOrEmpty(s))
            {
                string[]     mas   = s.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                PrimaryKeyId objId = PrimaryKeyId.Parse(Request["ObjectId"]);
                foreach (string item in mas)
                {
                    PrimaryKeyId id        = PrimaryKeyId.Parse(MetaViewGroupUtil.GetIdFromUniqueKey(item));
                    string       className = MetaViewGroupUtil.GetMetaTypeFromUniqueKey(item);

                    if (!String.IsNullOrEmpty(className) && className != MetaViewGroupUtil.keyValueNotDefined)
                    {
                        EntityObject eo = BusinessManager.Load(className, id);
                        if (eo != null && !String.IsNullOrEmpty(FilterFieldName) &&
                            eo.Properties[FilterFieldName] != null)
                        {
                            eo[FilterFieldName] = objId;
                            BusinessManager.Update(eo);
                        }
                    }
                }
                CHelper.RequireDataBind();
            }
        }
        /// <summary>
        /// Save credit card
        /// </summary>
        /// <param name="creditCardModel">Model of credit card</param>
        public void Save(CreditCardModel creditCardModel)
        {
            if (IsValid(creditCardModel.CreditCardId, out _))
            {
                var creditCard = GetCreditCard(creditCardModel.CreditCardId);
                var isNew      = creditCard == null;

                if (isNew)
                {
                    creditCard = Mediachase.Commerce.Customers.CreditCard.CreateInstance();
                }

                MapToCreditCard(creditCardModel, ref creditCard);

                if (isNew)
                {
                    //Create CC for user
                    if (creditCard.OrganizationId == null)
                    {
                        creditCard.ContactId = PrimaryKeyId.Parse(_customerService.GetCurrentContactViewModel().ContactId.ToString());
                    }

                    BusinessManager.Create(creditCard);
                }
                else
                {
                    BusinessManager.Update(creditCard);
                }
            }
        }
Example #8
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                if (cp.CommandArguments["SelectedValue"] == null)
                {
                    throw new ArgumentException("SelectedValue is null for ReassignHandler");
                }
                if (cp.CommandArguments["ObjectId"] == null)
                {
                    throw new ArgumentException("ObjectId is null for ReassignHandler");
                }

                int          userId       = int.Parse(cp.CommandArguments["SelectedValue"]);
                PrimaryKeyId assignmentId = PrimaryKeyId.Parse(cp.CommandArguments["ObjectId"]);

                AssignmentEntity assignment = (AssignmentEntity)BusinessManager.Load(AssignmentEntity.ClassName, assignmentId);
                assignment.UserId = userId;
                BusinessManager.Update(assignment);

                CHelper.AddToContext("RebindAssignments", true);
            }
        }
Example #9
0
        public static object ToEntityProperty(Type valueType, string value)
        {
            TypeCode typeCode = Type.GetTypeCode(valueType);
            object   retVal   = value;

            switch (typeCode)
            {
            case TypeCode.Boolean:
                retVal = Convert.ToBoolean(value);
                break;

            case TypeCode.Int32:
                retVal = Convert.ToInt32(value);
                break;

            case TypeCode.String:
                break;

            default:
                if (valueType == typeof(PrimaryKeyId))
                {
                    retVal = PrimaryKeyId.Parse(value);
                }
                else if (valueType.IsEnum)
                {
                    retVal = (int)Enum.Parse(valueType, value);
                }
                break;
            }

            return(retVal);
        }
Example #10
0
 public static EntityObject[] GetCustomerGiftCards(PrimaryKeyId contactId)
 {
     return(BusinessManager.List(GiftCardMetaClass, new[]
     {
         FilterElement.EqualElement(ContactIdField, contactId)
     }));
 }
Example #11
0
        /// <summary>
        /// Binds from value.
        /// </summary>
        private void BindFromValue(string metaClassName)
        {
            CommandParameters cp = new CommandParameters("MC_MUI_EntityDDSmall");

            cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
            if (!String.IsNullOrEmpty(metaClassName))
            {
                cp.AddCommandArgument("Classes", metaClassName);
            }
            cp.AddCommandArgument("Refresh", String.Format("Refresh{0}", this.ID));
            //Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());

            string scriptToExecute = CommandManager.GetCurrent(this.Page).AddCommand(metaClassName, string.Empty, string.Empty, cp);

            if (this.Value == null)
            {
                lblValue.Text = CHelper.GetResFileString("{IbnFramework.Common:tFilterSelectObject}");
            }
            else
            {
                PrimaryKeyId id  = PrimaryKeyId.Parse(this.Value.ToString());
                EntityObject obj = BusinessManager.Load(metaClassName, id);
                MetaClass    mc  = MetaDataWrapper.GetMetaClassByName(obj.MetaClassName);
                lblValue.Text = obj.Properties[mc.TitleFieldName].Value.ToString();
            }

            lblValue.Attributes.Add("onclick", scriptToExecute);
        }
Example #12
0
        protected string GetTitle(bool isClient, int prjId, PrimaryKeyId contactUid, PrimaryKeyId orgUid,
                                  string clientName, bool isCollapsed)
        {
            if (isClient)
            {
                string client = "";
                string key    = "";
                if (contactUid != PrimaryKeyId.Empty)
                {
                    client = CommonHelper.GetContactLink(this.Page, contactUid, clientName);
                    key    = "contact_" + contactUid.ToString();
                }
                else if (orgUid != PrimaryKeyId.Empty)
                {
                    client = CommonHelper.GetOrganizationLink(this.Page, orgUid, clientName);
                    key    = "org_" + orgUid.ToString();
                }
                else
                {
                    client = "<span style='width:4px'>&nbsp;</span><font color='#003399'>" + LocRM.GetString("tNoClient") + "</font>";
                    key    = "noclient";
                }

                _hash.Add(key, "CollapseExpand(" + (isCollapsed ? "1" : "0") + ",'" + contactUid.ToString() + "','" + orgUid.ToString() + "', event)");
                return("<table class='alt-tblstyle' style='width:100%'><tr><td class='text'>" +
                       "<b>" + "&nbsp;" + GetIcon(!isCollapsed) + "&nbsp;&nbsp;" + client + "</b>" +
                       "</td></tr></table>");
            }
            else
            {
                return("<span class='text' style='padding-left:15px'>" + CommonHelper.GetProjectStatusWithId(prjId) + "</span>");
            }
        }
Example #13
0
        private void BindDataGrid(bool dataBind)
        {
            grdMain.SearchKeyword = tbSearchString.Text.Trim();

            DataTable dt = ((DataTable)ViewState["Resources"]).Copy();
            FilterElementCollection fec = new FilterElementCollection();

            foreach (DataRow dr in dt.Rows)
            {
                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] == ddFilter.SelectedValue)
                {
                    MetaClass     mc = MetaDataWrapper.GetMetaClassByName(ddFilter.SelectedValue);
                    FilterElement fe = FilterElement.NotEqualElement(
                        SqlContext.Current.Database.Tables[mc.DataSource.PrimaryTable].PrimaryKey.Name,
                        PrimaryKeyId.Parse(elem[0]));
                    fec.Add(fe);
                }
            }
            grdMain.AddFilters = fec;

            if (dataBind)
            {
                grdMain.DataBind();
            }
        }
Example #14
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>");
            }
        }
Example #15
0
        public override void DataBind()
        {
            if (DataItem != null)
            {
                CalendarEventEntity ceo = (CalendarEventEntity)DataItem;
                FilterElementCollection fec = new FilterElementCollection();
                FilterElement fe = FilterElement.EqualElement("EventId", ((VirtualEventId)ceo.PrimaryKeyId).RealEventId);
                fec.Add(fe);
                fe = FilterElement.EqualElement("PrincipalId", Mediachase.IBN.Business.Security.CurrentUser.UserID);
                fec.Add(fe);

                EntityObject[] list = BusinessManager.List(CalendarEventResourceEntity.ClassName, fec.ToArray());
                if (list.Length > 0)
                {
                    CalendarEventResourceEntity cero = (CalendarEventResourceEntity)list[0];
                    _resId = cero.PrimaryKeyId.Value;
                    if (cero.Status.HasValue)
                    {
                        if (cero.Status.Value == (int)eResourceStatus.Accepted)
                            btnAccept.Disabled = true;
                        if (cero.Status.Value == (int)eResourceStatus.Tentative)
                            btnTentative.Disabled = true;
                        if (cero.Status.Value == (int)eResourceStatus.Declined)
                            btnDecline.Disabled = true;
                    }
                }
            }
            base.DataBind();
        }
Example #16
0
        protected string GetTitleClient(bool isClient, bool isCollapsed,
                                        PrimaryKeyId contactUid, PrimaryKeyId orgUid,
                                        string clientName, int docId, string title)
        {
            if (isClient)
            {
                string client = "";
                string key    = "";
                if (contactUid != PrimaryKeyId.Empty)
                {
                    client = CommonHelper.GetContactLink(this.Page, contactUid, clientName);
                    key    = "contact_" + contactUid.ToString();
                }
                else if (orgUid != PrimaryKeyId.Empty)
                {
                    client = CommonHelper.GetOrganizationLink(this.Page, orgUid, clientName);
                    key    = "org_" + orgUid.ToString();
                }
                else
                {
                    client = "<span style='width:4px'>&nbsp;</span><font color='#003399'>" + LocRM.GetString("tNoClient") + "</font>";
                    key    = "noclient";
                }

                _hash.Add(key, "CollapseExpand2(" + (isCollapsed ? "1" : "0") + ",'" + contactUid.ToString() + "','" + orgUid.ToString() + "', event)");
                return("<b>" + "&nbsp;" + GetIcon(!isCollapsed) + "&nbsp;&nbsp;" + client + "</b>");
            }
            else
            {
                return(String.Format("<span class='text' style='padding-left:25px'><a href='DocumentView.aspx?DocumentId={0}'>{1}</a></span>", docId, title));
            }
        }
Example #17
0
        public override void DataBind()
        {
            if (DataItem != null)
            {
                CalendarEventEntity     ceo = (CalendarEventEntity)DataItem;
                FilterElementCollection fec = new FilterElementCollection();
                FilterElement           fe  = FilterElement.EqualElement("EventId", ((VirtualEventId)ceo.PrimaryKeyId).RealEventId);
                fec.Add(fe);
                fe = FilterElement.EqualElement("PrincipalId", Mediachase.IBN.Business.Security.CurrentUser.UserID);
                fec.Add(fe);

                EntityObject[] list = BusinessManager.List(CalendarEventResourceEntity.ClassName, fec.ToArray());
                if (list.Length > 0)
                {
                    CalendarEventResourceEntity cero = (CalendarEventResourceEntity)list[0];
                    _resId = cero.PrimaryKeyId.Value;
                    if (cero.Status.HasValue)
                    {
                        if (cero.Status.Value == (int)eResourceStatus.Accepted)
                        {
                            btnAccept.Disabled = true;
                        }
                        if (cero.Status.Value == (int)eResourceStatus.Tentative)
                        {
                            btnTentative.Disabled = true;
                        }
                        if (cero.Status.Value == (int)eResourceStatus.Declined)
                        {
                            btnDecline.Disabled = true;
                        }
                    }
                }
            }
            base.DataBind();
        }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Check Security
                ListInfo     li     = ListManager.GetListInfoByMetaClassName(ClassName);
                PrimaryKeyId listId = li.PrimaryKeyId.Value;
                if (!Mediachase.IBN.Business.ListInfoBus.CanRead((int)listId))
                {
                    throw new AccessDeniedException();
                }
            }

            if (!String.IsNullOrEmpty(HistoryClassName))
            {
                gridHistory.DoPadding      = false;
                gridHistory.ShowCheckBoxes = false;
                gridHistory.ClassName      = HistoryClassName;
                gridHistory.PlaceName      = _placeName;
                string profileName = CHelper.GetHistorySystemListViewProfile(HistoryClassName, _placeName);
                gridHistory.ProfileName = profileName;
                CHelper.AddToContext("HistoryClassName", HistoryClassName);

                gridHistory.DataBind();
            }
        }
Example #19
0
 public static void UpdateClient(int GroupId, PrimaryKeyId contactUid, PrimaryKeyId orgUid)
 {
     DbHelper2.RunSp("GroupUpdateClient",
                     DbHelper2.mp("@PrincipalId", SqlDbType.Int, GroupId),
                     DbHelper2.mp("@ContactUid", SqlDbType.UniqueIdentifier, contactUid),
                     DbHelper2.mp("@OrgUid", SqlDbType.UniqueIdentifier, orgUid));
 }
Example #20
0
        /// <summary>
        ///	ItemId, Title, PriorityId, PriorityName, ItemType, CreationDate, StartDate, FinishDate,
        ///	PercentCompleted, IsCompleted, ManagerId, ReasonId, ProjectId, ProjectTitle,
        ///	StateId, CompletionTypeId,
        ///	TaskTime, TotalMinutes, TotalApproved, HasRecurrence, ContactUid, OrgUid, ClientName,
        ///	CategoryId, CategoryName
        /// </summary>
        /// <returns></returns>
        public static DataTable GetListEventsForManagerViewWithCategories(int PrincipalId,
                                                                          int TimeZoneId, int LanguageId, int ManagerId, int ProjectId, int categoryId,
                                                                          bool ShowActive,
                                                                          DateTime dtCompleted1, DateTime dtCompleted2,
                                                                          DateTime dtUpcoming1, DateTime dtUpcoming2,
                                                                          DateTime dtCreated1, DateTime dtCreated2,
                                                                          PrimaryKeyId orgUid, PrimaryKeyId contactUid)
        {
            object obj_dtCompleted1 = (dtCompleted1 <= DateTime.MinValue.AddDays(1)) ? null : (object)dtCompleted1;
            object obj_dtCompleted2 = (dtCompleted2 <= DateTime.MinValue.AddDays(1)) ? null : (object)dtCompleted2;
            object obj_dtUpcoming1  = (dtUpcoming1 >= DateTime.MaxValue.AddDays(-1)) ? null : (object)dtUpcoming1;
            object obj_dtUpcoming2  = (dtUpcoming2 >= DateTime.MaxValue.AddDays(-1)) ? null : (object)dtUpcoming2;
            object obj_dtCreated1   = (dtCreated1 <= DateTime.MinValue.AddDays(1)) ? null : (object)dtCreated1;
            object obj_dtCreated2   = (dtCreated2 <= DateTime.MinValue.AddDays(1)) ? null : (object)dtCreated2;

            return(DbHelper2.RunSpDataTable(
                       TimeZoneId, new string[] { "CreationDate", "StartDate", "FinishDate" },
                       "EventsGetForManagerViewWithCategories",
                       DbHelper2.mp("@PrincipalId", SqlDbType.Int, PrincipalId),
                       DbHelper2.mp("@LanguageId", SqlDbType.Int, LanguageId),
                       DbHelper2.mp("@ManagerId", SqlDbType.Int, ManagerId),
                       DbHelper2.mp("@ProjectId", SqlDbType.Int, ProjectId),
                       DbHelper2.mp("@CategoryId", SqlDbType.Int, categoryId),
                       DbHelper2.mp("@ShowActive", SqlDbType.Bit, ShowActive),
                       DbHelper2.mp("@CompletedDate1", SqlDbType.DateTime, obj_dtCompleted1),
                       DbHelper2.mp("@CompletedDate2", SqlDbType.DateTime, obj_dtCompleted2),
                       DbHelper2.mp("@StartDate1", SqlDbType.DateTime, obj_dtUpcoming1),
                       DbHelper2.mp("@StartDate2", SqlDbType.DateTime, obj_dtUpcoming2),
                       DbHelper2.mp("@CreationDate1", SqlDbType.DateTime, obj_dtCreated1),
                       DbHelper2.mp("@CreationDate2", SqlDbType.DateTime, obj_dtCreated2),
                       DbHelper2.mp("@OrgUid", SqlDbType.UniqueIdentifier, orgUid),
                       DbHelper2.mp("@ContactUid", SqlDbType.UniqueIdentifier, contactUid)));
        }
Example #21
0
        protected override void PreList(BusinessContext context)
        {
            ListRequest listRequest = context.Request as ListRequest;
            bool        forceBase   = listRequest.Parameters.GetValue <bool>(EventHelper.FORCE_BASE_PARAM, false);

            if (!forceBase)
            {
                object filterValue = EventHelper.RecursiveFindFilterElementValue(listRequest.Filters,
                                                                                 CalendarEventRecurrenceEntity.FieldEventId);
                if (filterValue != null)
                {
                    //try first load exception
                    PrimaryKeyId eventId = PrimaryKeyId.Parse(filterValue.ToString());
                    if (EventHelper.LoadCalEvent(eventId) == null)
                    {
                        //convert him to series id)
                        eventId = (PrimaryKeyId)(VirtualEventId)eventId;
                    }
                    listRequest.Filters = EventHelper.RecursiveReplaceFilterElementValue(listRequest.Filters,
                                                                                         CalendarEventRecurrenceEntity.FieldEventId,
                                                                                         eventId);
                }
            }
            base.PreList(context);
        }
Example #22
0
 public static void CollapseByClient(int UserId, PrimaryKeyId contactUid, PrimaryKeyId orgUid)
 {
     DbHelper2.RunSp("CollapsedToDoByClientAdd",
         DbHelper2.mp("@UserId", SqlDbType.Int, UserId),
         DbHelper2.mp("@ContactUid", SqlDbType.UniqueIdentifier, contactUid),
         DbHelper2.mp("@OrgUid", SqlDbType.UniqueIdentifier, orgUid));
 }
Example #23
0
        /// <summary>
        /// Deletes the principal.
        /// </summary>
        /// <param name="primaryKeyId">The primary key id.</param>
        internal static void UpdatePrincipal(PrimaryKeyId primaryKeyId, string name)
        {
            DirectoryPrincipalEntity principal = (DirectoryPrincipalEntity)BusinessManager.Load(DirectoryPrincipalEntity.ClassName, primaryKeyId);

            principal.Name = name;
            BusinessManager.Update(principal);
        }
Example #24
0
        public void BindData(MetaField field)
        {
            string sReferencedClass = field.Attributes[McDataTypeAttribute.ReferenceMetaClassName].ToString();

            ViewState["ReferencedClass"] = sReferencedClass;
            if (sReferencedClass == TimeTrackingEntry.GetAssignedMetaClass().Name ||
                sReferencedClass == TimeTrackingBlock.GetAssignedMetaClass().Name ||
                sReferencedClass == TimeTrackingBlockType.GetAssignedMetaClass().Name ||
                sReferencedClass == TimeTrackingBlockTypeInstance.GetAssignedMetaClass().Name ||
                sReferencedClass == Principal.GetAssignedMetaClass().Name ||
                Mediachase.IBN.Business.Security.CurrentUser == null)
            {
                tblEntity.Visible = false;
                string url = ResolveClientUrl(String.Format("~/Apps/MetaUI/Pages/Public/SelectItem.aspx?class={0}&btn={1}", sReferencedClass, Page.ClientScript.GetPostBackEventReference(btnRefresh, "xxx")));

                ibSelect.OnClientClick = String.Format("OpenPopUpWindow(\"{0}\", 640, 480, 1); return false;", url);
            }
            else
            {
                ReferenceUpdatePanel.Visible = false;
                refObjects.ObjectTypes       = sReferencedClass;
                if (Request["ContainerFieldName"] != null &&
                    field.Name == Request["ContainerFieldName"] &&
                    Request["ContainerId"] != null)
                {
                    this.Value = PrimaryKeyId.Parse(Request["ContainerId"]);
                }
            }
        }
Example #25
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp         = (CommandParameters)Element;
                PrimaryKeyId      key        = PrimaryKeyId.Parse(cp.CommandArguments["ObjectId"]);
                string            deleteType = cp.CommandArguments["DeleteType"];       // 0: org only; 1: org & contacts

                int           errorCount = 0;
                string        className  = OrganizationEntity.GetAssignedMetaClassName();
                DeleteRequest request    = new DeleteRequest(className, key);
                request.Parameters.Add(OrganizationRequestParameters.Delete_RelatedContactAction, (deleteType == "0") ? RelatedContactAction.Detach : RelatedContactAction.Delete);

                try
                {
                    BusinessManager.Execute(request);
                }
                catch (Exception ex)
                {
                    CHelper.GenerateErrorReport(ex);
                    errorCount++;
                }

                if (errorCount > 0)
                {
                    ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:ActionWasNotProcessed}");
                }
                else
                {
                    ((Control)Sender).Page.Response.Redirect(CHelper.GetLinkEntityList(className));
                }
            }
        }
Example #26
0
        public void Invoke(object Sender, object Element)
        {
            string objectid = ((Control)Sender).Page.Request["ObjectId"];

            if (!String.IsNullOrEmpty(objectid))
            {
                PrimaryKeyId key = PrimaryKeyId.Parse(objectid);
                key = ((VirtualEventId)key).RealEventId;

                int errorCount = 0;
                try
                {
                    BusinessManager.Delete(CalendarEventEntity.ClassName, key);
                }
                catch (Exception ex)
                {
                    CHelper.GenerateErrorReport(ex);
                    errorCount++;
                }

                if (errorCount > 0)
                {
                    ((CommandManager)Sender).InfoMessage = CHelper.GetResFileString("{IbnFramework.Common:ActionWasNotProcessed}");
                }
                else
                {
                    ((Control)Sender).Page.Response.Redirect("~/Apps/Calendar/Pages/Calendar.aspx", true);
                }
            }
        }
Example #27
0
        public static bool DebitGiftCard(string giftCardMetaClass, PrimaryKeyId contactId, string redemtionCode, decimal debitAmount)
        {
            var cards = BusinessManager.List(giftCardMetaClass,
                                             new FilterElement[]
            {
                FilterElement.EqualElement("ContactId", contactId),
                FilterElement.EqualElement("IsActive", true),
                FilterElement.EqualElement("RedemtionCode", redemtionCode)
            });

            if (cards == null || cards.Count() == 0)
            {
                return(false);
            }
            var card = cards[0];

            if ((decimal)card["Balance"] < debitAmount)
            {
                return(false);
            }
            decimal newBalance = (decimal)card["Balance"] - debitAmount;

            card["Balance"] = newBalance;
            if (newBalance == 0)
            {
                card["IsActive"] = false;
            }
            BusinessManager.Update(card);

            return(true);
        }
Example #28
0
        /// <summary>
        /// Adds the message to outgoing queue.
        /// </summary>
        /// <param name="referenceFieldName">Name of the reference field.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <param name="source">The source.</param>
        /// <returns></returns>
        protected PrimaryKeyId AddMessageToOutgoingQueue(string metaClassName, string referenceFieldName, PrimaryKeyId primaryKeyId, string source)
        {
            OutgoingMessageQueueEntity newElement = BusinessManager.InitializeEntity <OutgoingMessageQueueEntity>(OutgoingMessageQueueEntity.ClassName);

            newElement[referenceFieldName] = primaryKeyId;
            newElement.Source = source;

            return(BusinessManager.Create(newElement));
        }
Example #29
0
 public static EntityObject[] GetClientGiftCards(string giftCardMetaClass, PrimaryKeyId contactId)
 {
     return(BusinessManager.List(giftCardMetaClass,
                                 new FilterElement[]
     {
         FilterElement.EqualElement("ContactId", contactId),
         FilterElement.EqualElement("IsActive", true)
     }));
 }
Example #30
0
 public static void AddEntityHistory(string className, PrimaryKeyId objectId, string objectTitle, int userId, bool isView)
 {
     DbHelper2.RunSp("HistoryEntityAdd",
         DbHelper2.mp("@ClassName", SqlDbType.NVarChar, 250, className),
         DbHelper2.mp("@ObjectId", SqlDbType.VarChar, 36, objectId.ToString()),
         DbHelper2.mp("@ObjectTitle", SqlDbType.NVarChar, 250, objectTitle),
         DbHelper2.mp("@UserId", SqlDbType.Int, userId),
         DbHelper2.mp("@IsView", SqlDbType.Bit, isView));
 }
Example #31
0
        /// <summary>
        /// Handles the Click event of the lblCreate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void lblCreate_Click(object sender, EventArgs e)
        {
            WorkflowDefinitionEntity en = BusinessManager.InitializeEntity <WorkflowDefinitionEntity>(WorkflowDefinitionEntity.ClassName);

            en.Name = tbName.Text;
            PrimaryKeyId newId = BusinessManager.Create(en);

            Response.Redirect(String.Format("~/TestWF.aspx?WfId={0}", newId.ToString()));
        }
Example #32
0
        /// <summary>
        /// Adds the message to outgoing queue.
        /// </summary>
        /// <param name="referenceFieldName">Name of the reference field.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <param name="source">The source.</param>
        /// <returns></returns>
        protected PrimaryKeyId AddMessageToOutgoingQueue(string metaClassName, string referenceFieldName, PrimaryKeyId primaryKeyId, string source)
        {
            OutgoingMessageQueueEntity newElement = BusinessManager.InitializeEntity<OutgoingMessageQueueEntity>(OutgoingMessageQueueEntity.ClassName);

            newElement[referenceFieldName] = primaryKeyId;
            newElement.Source = source;

            return BusinessManager.Create(newElement);
        }
Example #33
0
        void btnOnlyThis_Click(object sender, EventArgs e)
        {
            PrimaryKeyId      pKey = PrimaryKeyId.Parse(Request["ObjectId"]);
            CommandParameters cp   = new CommandParameters(Request["CommandName"]);

            cp.CommandArguments = new Dictionary <string, string>();
            cp.AddCommandArgument("Uid", pKey.ToString());
            CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
        }
Example #34
0
        protected void Collapse_Expand_Click(object sender, System.EventArgs e)
        {
            string sType  = hdnColType.Value;
            string ceType = hdnCollapseExpand.Value;

            if (sType.ToLower() == "prj")
            {
                int prjId = int.Parse(hdnDocumentId.Value);
                if (ceType == "0")
                {
                    Document.Collapse(prjId);
                }
                else
                {
                    Document.Expand(prjId);
                }
            }
            else if (sType.ToLower() == "contact")
            {
                PrimaryKeyId contactUid = PrimaryKeyId.Parse(hdnDocumentId.Value);
                if (ceType == "0")
                {
                    Document.CollapseByClient(contactUid, PrimaryKeyId.Empty);
                }
                else
                {
                    Document.ExpandByClient(contactUid, PrimaryKeyId.Empty);
                }
            }
            else if (sType.ToLower() == "org")
            {
                PrimaryKeyId orgUid = PrimaryKeyId.Parse(hdnDocumentId.Value);
                if (ceType == "0")
                {
                    Document.CollapseByClient(PrimaryKeyId.Empty, orgUid);
                }
                else
                {
                    Document.ExpandByClient(PrimaryKeyId.Empty, orgUid);
                }
            }
            else if (sType.ToLower() == "noclient")
            {
                if (ceType == "0")
                {
                    Document.CollapseByClient(PrimaryKeyId.Empty, PrimaryKeyId.Empty);
                }
                else
                {
                    Document.ExpandByClient(PrimaryKeyId.Empty, PrimaryKeyId.Empty);
                }
            }
            hdnColType.Value    = "";
            hdnDocumentId.Value = "";
            BindDataGrid();
        }
Example #35
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);
            }
        }
Example #36
0
        /// <summary>
        /// Creates the principal.
        /// </summary>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <param name="name">The name.</param>
        internal static void CreatePrincipal(DirectoryPrincipalType principalType, PrimaryKeyId primaryKeyId, string name)
        {
            DirectoryPrincipalEntity principal = (DirectoryPrincipalEntity)BusinessManager.InitializeEntity(DirectoryPrincipalEntity.ClassName);

            principal["DirectoryPrincipalId"] = primaryKeyId;
            principal.Type = (int)principalType;
            principal.Name = name;

            BusinessManager.Create(principal);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == CalendarEventResourceEntity.ClassName)
            {
                CalendarEventResourceEntity retVal = new CalendarEventResourceEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == DirectoryWorkGroupEntity.ClassName)
            {
                DirectoryWorkGroupEntity retVal = new DirectoryWorkGroupEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == WorkflowDefinitionEntity.ClassName)
            {
                WorkflowDefinitionEntity retVal = new WorkflowDefinitionEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == DocumentContentVersionEntity.GetAssignedMetaClassName())
            {
                DocumentContentVersionEntity retVal = new DocumentContentVersionEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == OutgoingMessageQueueEntity.ClassName)
            {
                OutgoingMessageQueueEntity retVal = new OutgoingMessageQueueEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
Example #42
0
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == AssignmentEntity.ClassName)
            {
                AssignmentEntity retVal = new AssignmentEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == CustomizationProfileUserEntity.ClassName)
            {
                CustomizationProfileUserEntity retVal = new CustomizationProfileUserEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
Example #44
0
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == AddressEntity.GetAssignedMetaClassName())
            {
                AddressEntity retVal = new AddressEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == IbnClientMessageEntity.ClassName)
            {
                IbnClientMessageEntity retVal = new IbnClientMessageEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
Example #46
0
        /// <summary>
        /// Determines whether this instance can read the specified report id.
        /// </summary>
        /// <param name="reportId">The report id.</param>
        /// <param name="userId">The user id.</param>
        /// <returns>
        /// 	<c>true</c> if this instance can read the specified report id; otherwise, <c>false</c>.
        /// </returns>
        public static bool CanRead(PrimaryKeyId reportId, int userId)
        {
            SqlParameter retVal = SqlHelper.CreateRetvalSqlParameter();

            SqlHelper.ExecuteNonQuery(SqlContext.Current,
                CommandType.StoredProcedure, "mc_mcweb_ReportAceCanUserRead",
                SqlHelper.SqlParameter("@UserId", SqlDbType.Int, userId),
                SqlHelper.SqlParameter("@ReportId", SqlDbType.UniqueIdentifier, reportId),
                retVal);

            return ((int)retVal.Value) == 1;
        }
Example #47
0
        public static void Update(int documentId, string title, string description,
			int priorityId, int managerId, int taskTime, ArrayList categories,
			PrimaryKeyId ContactUid, PrimaryKeyId OrgUid)
        {
            VerifyCanUpdate(documentId);

            using(DbTransaction tran = DbTransaction.Begin())
            {
                UpdateGeneralInfo(documentId, title, description, false);
                UpdatePriority(documentId, priorityId, false);
                UpdateManager(documentId, managerId, false);
                UpdateCategories(ListAction.Set, documentId, categories, false);
                UpdateTimeLine(documentId, taskTime, false);
                UpdateClient(documentId, ContactUid, OrgUid, false);

                tran.Commit();
            }
        }
Example #48
0
        /// <summary>
        /// Adds the navigation item.
        /// </summary>
        /// <param name="parentFullId">The parent full id.</param>
        /// <param name="order">The order.</param>
        /// <param name="text">The text.</param>
        /// <param name="url">The URL.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        public static void AddNavigationItem(string parentFullId, int order, string text, string url, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        {
            using (TransactionScope transaction = DataContext.Current.BeginTransaction())
            {
                // Create item
                CustomizationItemEntity item = CreateCustomizationItemByParent(parentFullId, CustomizationStructureType.NavigationMenu, ItemCommandType.Add, profileId, principalId);

                CreateCustomizationItemArgument(item.PrimaryKeyId.Value, ItemArgumentText, text);
                CreateCustomizationItemArgument(item.PrimaryKeyId.Value, ItemArgumentOrder, order.ToString());
                CreateCustomizationItemArgument(item.PrimaryKeyId.Value, ItemArgumentCommand, Guid.NewGuid().ToString("D"));
                if (!string.IsNullOrEmpty(url))
                    CreateCustomizationItemArgument(item.PrimaryKeyId.Value, ItemArgumentUrl, url);

                transaction.Commit();
            }

            ClearCache(profileId, principalId);
        }
Example #49
0
        /// <summary>
        /// Creates the instance.
        /// </summary>
        /// <param name="metaClass">The meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        MetaObject IMetaObjectFactory.CreateInstance(Mediachase.Ibn.Data.Meta.Management.MetaClass metaClass, PrimaryKeyId primaryKeyId)
        {
            if (metaClass == null)
                throw new ArgumentNullException("metaClass");

            switch (metaClass.Name)
            {
                case "TimeTrackingEntry":
                    return new TimeTrackingEntry(primaryKeyId);
                case "TimeTrackingBlock":
                    return new TimeTrackingBlock(primaryKeyId);
                case "TimeTrackingBlockType":
                    return new TimeTrackingBlockType(primaryKeyId);
                case "TimeTrackingBlockTypeInstance":
                    return new TimeTrackingBlockTypeInstance(primaryKeyId);
            }

            throw new NotSupportedException("MetaClass '" + metaClass.Name + "' is not supported.");
        }
Example #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResumeAssignmentRequest"/> class.
 /// </summary>
 /// <param name="primaryKeyId">The primary key id.</param>
 public ResumeAssignmentRequest(PrimaryKeyId primaryKeyId)
     : base(AssignmentRequestMethod.Resume, new AssignmentEntity(primaryKeyId))
 {
 }
Example #51
0
        internal static void UpdateClient(int eventId, PrimaryKeyId contactUid, PrimaryKeyId orgUid, bool checkAccess)
        {
            if(checkAccess)
                VerifyCanUpdate(eventId);

            using(DbTransaction tran = DbTransaction.Begin())
            {
                if (0 < DbCalendarEntry2.UpdateClient(eventId, contactUid == PrimaryKeyId.Empty ? null : (object)contactUid, orgUid == PrimaryKeyId.Empty ? null : (object)orgUid))
                {
                    // TODO:
                    //SystemEvents.AddSystemEvents(SystemEventTypes.CalendarEntry_Updated_Client, projectId);
                }

                tran.Commit();
            }
        }
Example #52
0
 public static void UpdateClient(int eventId, PrimaryKeyId contactUid, PrimaryKeyId orgUid)
 {
     UpdateClient(eventId, contactUid, orgUid, true);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StartWorkflowInstanceRequest"/> class.
 /// </summary>
 /// <param name="workflowInstanceId">The workflow instance id.</param>
 public StartWorkflowInstanceRequest(PrimaryKeyId workflowInstanceId)
     : base(WorkflowInstanceMethod.Start, new WorkflowInstanceEntity(workflowInstanceId))
 {
 }
Example #54
0
        /// <summary>
        ///  ContactUid, OrgUid, IsClient, ClientName, ProjectId, ProjectName, StatusName, 
        ///  OpenTasks, CompletedTasks, Issues, IsCollapsed
        /// </summary>
        /// <returns></returns>
        public static DataTable GetListProjectsGroupedByClient(int portfolioId,
			int phaseId, int statusId, int managerId, int userId,
			int languageId, PrimaryKeyId orgUid, PrimaryKeyId contactUid)
        {
            return DbHelper2.RunSpDataTable("ProjectsGetGroupedByClient",
                DbHelper2.mp("@PortfolioId", SqlDbType.Int, portfolioId),
                DbHelper2.mp("@PhaseId", SqlDbType.Int, phaseId),
                DbHelper2.mp("@StatusId", SqlDbType.Int, statusId),
                DbHelper2.mp("@ManagerId", SqlDbType.Int, managerId),
                DbHelper2.mp("@UserId", SqlDbType.Int, userId),
                DbHelper2.mp("@LanguageId", SqlDbType.Int, languageId),
                DbHelper2.mp("@OrgUid", SqlDbType.UniqueIdentifier, orgUid),
                DbHelper2.mp("@ContactUid", SqlDbType.UniqueIdentifier, contactUid));
        }
Example #55
0
 public static void ExpandByClient(int UserId, PrimaryKeyId contactUid, PrimaryKeyId orgUid)
 {
     DbHelper2.RunSp("CollapsedProjectByClientDelete",
         DbHelper2.mp("@UserId", SqlDbType.Int, UserId),
         DbHelper2.mp("@ContactUid", SqlDbType.UniqueIdentifier, contactUid),
         DbHelper2.mp("@OrgUid", SqlDbType.UniqueIdentifier, orgUid));
 }
 public DirectoryWorkGroupEntity(string metaClassName, PrimaryKeyId primaryKeyId)
     : base(metaClassName, primaryKeyId)
 {
     InitializeProperties();
 }
 public DirectoryWorkGroupEntity(PrimaryKeyId primaryKeyId)
     : base("DirectoryWorkGroup", primaryKeyId)
 {
     InitializeProperties();
 }
Example #58
0
        public static void GetDefaultClient(string defaultString,
			out PrimaryKeyId contact_uid, out PrimaryKeyId org_uid)
        {
            org_uid = PrimaryKeyId.Empty;
            contact_uid = PrimaryKeyId.Empty;
            if (!String.IsNullOrEmpty(defaultString) && defaultString != "_")
            {
                string className = defaultString.Substring(0, defaultString.IndexOf("_"));
                string uid = defaultString.Substring(defaultString.IndexOf("_") + 1);
                if (className.ToLower() == OrganizationEntity.GetAssignedMetaClassName().ToLower())
                    org_uid = PrimaryKeyId.Parse(uid);
                else
                    contact_uid = PrimaryKeyId.Parse(uid);
            }
        }
Example #59
0
 public static void DeleteEntityHistory(string className, PrimaryKeyId objectId)
 {
     DBCommon.DeleteEntityHistory(className, objectId);
 }
Example #60
0
 public static void AddUsedEntityHistory(string className, PrimaryKeyId objectId, string title)
 {
     DBCommon.AddEntityHistory(className, objectId, title, Security.CurrentUser.UserID, false);
 }