示例#1
2
 public override void HandlePresence(ASC.Xmpp.Server.Streams.XmppStream stream, Presence presence, XmppHandlerContext context)
 {
     //Presence to open new room
     if (IsUserAbleToCreateRooms(presence.From) && MucHelpers.IsJoinRequest(presence))
     {
         //Register
         Service.CreateRoom(new Jid(presence.To.Bare), null);
         Service.HandlerManager.ProcessStreamElement(presence, stream);//Forward to room
     }
     else
     {
         //Return error
         presence.Type = PresenceType.error;
         presence.Error = new Error(ErrorType.cancel, ErrorCondition.NotAllowed);
         presence.SwitchDirection();
         context.Sender.SendTo(stream, presence);
     }
 }
        public static void NotifyAboutSharingCalendar(ASC.Api.Calendar.BusinessObjects.Calendar calendar, ASC.Api.Calendar.BusinessObjects.Calendar oldCalendar)
        {
            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), SecurityContext.CurrentAccount.Name));
            try
            {
                var usr = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
                var userLink = PerformUrl(CommonLinkUtility.GetUserProfile(usr.ID.ToString(), Guid.Empty, UserProfileType.General, false));

                foreach (var item in calendar.SharingOptions.PublicItems)
                {
                    if (oldCalendar != null && oldCalendar.SharingOptions.PublicItems.Exists(i => i.Id.Equals(item.Id)))
                        continue;

                    var r = CalendarNotifySource.Instance.GetRecipientsProvider().GetRecipient(item.Id.ToString());
                    _notifyClient.SendNoticeAsync(CalendarNotifySource.CalendarSharing, null, r, true,
                        new TagValue(new Tag("SharingType"), "calendar"),
                        new TagValue(new Tag("UserName"), usr.DisplayUserName()),
                        new TagValue(new Tag("UserLink"), userLink),
                        new TagValue(new Tag("CalendarName"), calendar.Name));
                }
                _notifyClient.EndSingleRecipientEvent(_syncName);
            }
            finally
            {
                _notifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
示例#3
0
 private void GetIndexes()
 {
     foreach (MemberHandler member in this.Members)
     {
         IndexAttribute[] attributes = member.MemberInfo.GetAttributes <IndexAttribute>(false);
         CheckIndexAttributes(attributes);
         foreach (IndexAttribute attribute in attributes)
         {
             ASC    item = attribute.ASC ? ((ASC)member.Name) : ((DESC)member.Name);
             string key  = attribute.IndexName ?? item.Key;
             if (!this.Indexes.ContainsKey(key))
             {
                 this.Indexes.Add(key, new List <ASC>());
             }
             this.Indexes[key].Add(item);
             if (attribute.UNIQUE)
             {
                 if (!this.UniqueIndexes.ContainsKey(key))
                 {
                     this.UniqueIndexes.Add(key, new List <MemberHandler>());
                 }
                 this.UniqueIndexes[key].Add(member);
             }
         }
     }
 }
 public override void PreMethodCall(Api.Interfaces.IApiMethodCall method, ASC.Api.Impl.ApiContext context, System.Collections.Generic.IEnumerable<object> arguments)
 {
     //Log method call
     TryLog(LogEntry.Actions.BeforeCall,method,context, null);
     base.PreMethodCall(method, context, arguments);
     Sw.Start();
 }
示例#5
0
        public ActionResult DeleteConfirmed(int id)
        {
            ASC aSC = db.ASCs.Find(id);

            db.ASCs.Remove(aSC);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#6
0
        public IEnumerable<ASC.Common.Security.Authorizing.IRole> GetObjectRoles(ASC.Common.Security.Authorizing.ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
        {
            List<IRole> roles = new List<IRole>();
            if (account.ID.Equals(this.OwnerId))
                roles.Add(ASC.Common.Security.Authorizing.Constants.Owner);

            return roles;
        }
示例#7
0
 public EventWrapper(ASC.Web.Community.News.Code.Feed feed)
 {
     Id=feed.Id;
     Title=feed.Caption;
     Updated = Created=(ApiDateTime) feed.Date;
     Type =feed.FeedType;
     CreatedBy = EmployeeWraper.Get(Core.CoreContext.UserManager.GetUsers(new Guid(feed.Creator)));
 }
示例#8
0
 private void AddOrderBy(ASC item)
 {
     if (_order == null)
     {
         _order = new OrderBy();
     }
     _order.OrderItems.Add(item);
 }
示例#9
0
        public override void HandleMessage(ASC.Xmpp.Server.Streams.XmppStream stream, Message msg, XmppHandlerContext context)
        {
            msg.SwitchDirection();
            msg.Type = MessageType.error;
            msg.Error = new Error(ErrorType.cancel, ErrorCondition.ItemNotFound);
            context.Sender.SendTo(stream, msg);

        }
示例#10
0
 private void AddOrderBy(ASC item)
 {
     if (Orderby == null)
     {
         Orderby = new OrderBy();
     }
     Orderby.OrderItems.Add(item);
 }
示例#11
0
        public PublicItemWrapper( ASC.Web.Core.Calendars.SharingOptions.PublicItem publicItem, string calendartId, Guid owner)
        {
            base.Id = publicItem.Id;
            base.IsGroup = publicItem.IsGroup;

            _owner = owner;
            _calendarId = calendartId;
            _isCalendar = true;
        }
示例#12
0
 public EventWrapperFull(ASC.Web.Community.News.Code.Feed feed)
     : base(feed)
 {
     if (feed is FeedPoll)
     {
         //Add poll info
         var poll = feed as FeedPoll;
         Poll = new PollWrapper(poll);
     }
     Text = feed.Text;
 }
示例#13
0
 public ActionResult Edit([Bind(Include = "ascid,dsid,ascname")] ASC aSC)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aSC).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.dsid = new SelectList(db.DS, "dsid", "dsname", aSC.dsid);
     return(View(aSC));
 }
        public IEnumerable<ASC.Common.Security.Authorizing.IRole> GetObjectRoles(ASC.Common.Security.Authorizing.ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
        {
            var roles = new List<IRole>();

            if (!Guid.Empty.Equals(Object.OwnerID) && Object.OwnerID.Equals(account.ID))
            {
                roles.Add(ASC.Common.Security.Authorizing.Constants.Owner);
            }

            return roles;
        }
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == PhotoConst.NewEventComment)
     {
         if (request.Arguments.Exists((tv) => tv.Tag.Name == "FEED_TYPE"))
         {
             return ActionPatternProvider.GetPattern(PhotoConst.NewPhotoUploaded, senderName) ?? ActionPatternProvider.GetPattern(PhotoConst.NewPhotoUploaded);
         }
     }
     return null;
 }
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == Constants.EditPage)
     {
         var tag = request.Arguments.Find(t => t.Tag == "ChangeType");
         if (tag != null && tag.Value.ToString() == "new wiki page comment")
         {
             return PatternProvider.GetPattern(new NotifyAction(tag.Value.ToString()), senderName);
         }
     }
     return null;
 }
 public override IQ HandleIQ(ASC.Xmpp.Server.Streams.XmppStream stream, IQ iq, XmppHandlerContext context)
 {
     if (iq.Vcard!=null && iq.Type==IqType.get)
     {
         //Handle vcard
         iq.Vcard = Member.GetVcard();
         iq.Type = IqType.result;
         iq.SwitchDirection();
         return iq;
     }
     return base.HandleIQ(stream, iq, context);
 }
 public override void PostMethodCall(ASC.Api.Interfaces.IApiMethodCall method, ASC.Api.Impl.ApiContext context, object methodResponce)
 {
     try
     {
         context.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");
     }
     catch (Exception)
     {
         
     }
     base.PostMethodCall(method, context, methodResponce);
 }
示例#19
0
        public ActionResult Create([Bind(Include = "ascid,dsid,ascname")] ASC aSC)
        {
            if (ModelState.IsValid)
            {
                db.ASCs.Add(aSC);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            ViewBag.dsid = new SelectList(db.DS, "dsid", "dsname", aSC.dsid);
            return(View(aSC));
        }
示例#20
0
        public override void PostMethodCall(IApiMethodCall method, ASC.Api.Impl.ApiContext context, object methodResponce)
        {
            var pubSub = ServiceLocator.Current.GetInstance<IApiPubSub>();

            if (pubSub != null)
            {
                pubSub.PublishDataForKey(
                    method.RoutingPollUrl + ":" +
                    PubSubKeyHelper.GetKeyForRoute(context.RequestContext.RouteData.Route.GetRouteData(context.RequestContext.HttpContext)),
                    new ApiMethodCallData(){Method = method,Result = methodResponce});
            }
            base.PostMethodCall(method, context, methodResponce);
        }
示例#21
0
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == Constants.EditPage)
     {
         var tag = request.Arguments.Find((tv) => tv.Tag.Name == "ChangeType");
         if (tag != null && tag.Value.ToString() == "new wiki page comment")
         {
             if (senderName == "email.sender") return PatternProvider.GetPattern("3");
             if (senderName == "messanger.sender") return PatternProvider.GetPattern("3_jabber");
         }
     }
     return null;
 }
示例#22
0
        public void Initialize()
        {
            cart = new Cart();

            product1 = new ASC {
                Name = "ASC1", Price = 1
            };
            product2 = new Case {
                Name = "Case1", Price = 1.5m
            };
            product3 = new ASC {
                Name = "ASC2", Price = 2
            };
        }
示例#23
0
文件: VoxelASCII.cs 项目: gdgeek/fly
 // Use this for initialization
 private void refresh(char ch)
 {
     //			Debug.Log (ch);
     ASC asc = new ASC();
     asc.ch = ch;
     asc.file = "vox/number/asc" + ((int)(ch)).ToString() + ".vox";
     asc.loading = (VoxelFilePreLoading)GameObject.Instantiate (_prototype);
     asc.loading.gameObject.transform.SetParent (_offset.transform);
     asc.loading.gameObject.name = "asc_" + ((int)(ch)).ToString();
     asc.loading._vodFile = asc.file;
     asc.loading._refresh = true;
     asc.loading.gameObject.SetActive (true);
     _ascii.Add(asc);
 }
示例#24
0
        // GET: ASCs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ASC aSC = db.ASCs.Find(id);

            if (aSC == null)
            {
                return(HttpNotFound());
            }
            return(View(aSC));
        }
示例#25
0
        // GET: ASCs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ASC aSC = db.ASCs.Find(id);

            if (aSC == null)
            {
                return(HttpNotFound());
            }
            ViewBag.dsid = new SelectList(db.DS, "dsid", "dsname", aSC.dsid);
            return(View(aSC));
        }
示例#26
0
        public ActionResult Edit(ASC product, string url, HttpPostedFileBase image = null)
        {
            TempData["returnUrl"] = url;

            if (ModelState.IsValid)
            {
                helper.EditProduct(product, image);

                return(RedirectToAction("List"));
            }
            else
            {
                return(View(product));
            }
        }
示例#27
0
        // Use this for initialization
        private void refresh(char ch)
        {
//			Debug.Log (ch);
            ASC asc = new ASC();

            asc.ch      = ch;
            asc.file    = "vox/number/asc" + ((int)(ch)).ToString() + ".vox";
            asc.loading = (VoxelFileLoader)GameObject.Instantiate(_prototype);
            asc.loading.gameObject.transform.SetParent(_offset.transform);
            asc.loading.gameObject.name = "asc_" + ((int)(ch)).ToString();
            asc.loading._vodFile        = asc.file;
            //asc.loading._refresh = true;
            //asc.loading.gameObject.SetActive (true);
            asc.loading.read();
            _ascii.Add(asc);
        }
 public UserContentActivity(ASC.Web.Core.Users.Activity.UserActivity userActivity)
 {
     ActionText = userActivity.ActionText;
     ActionType = userActivity.ActionType;
     BusinessValue = userActivity.BusinessValue;
     ContentID = userActivity.ContentID;
     Date = userActivity.Date;
     ModuleID = userActivity.ModuleID;
     ProductID = userActivity.ProductID;
     Title = userActivity.Title;
     URL = userActivity.URL;
     UserID = userActivity.UserID;
     ContainerID = userActivity.ContainerID;
     AdditionalData = userActivity.AdditionalData;
     ImageOptions = userActivity.ImageOptions;
 }
        public override void PreMethodCall(ASC.Api.Interfaces.IApiMethodCall method, ASC.Api.Impl.ApiContext context, System.Collections.Generic.IEnumerable<object> arguments)
        {
            //Check culture and set
            var tenant = CoreContext.TenantManager.GetCurrentTenant(false);
            if (tenant != null)
            {
                var culture = tenant.GetCulture();
                Thread.CurrentThread.CurrentCulture = culture;
                Thread.CurrentThread.CurrentUICulture = culture;
            }

            if (SecurityContext.IsAuthenticated)
            {
                var culture = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).GetCulture();
                Thread.CurrentThread.CurrentCulture = culture;
                Thread.CurrentThread.CurrentUICulture = culture;
            }
        }
 public IEnumerable<IRole> GetObjectRoles(ASC.Common.Security.Authorizing.ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
 {
     return account.ID == CreatorID ? new[] { Constants.Owner } : new IRole[0];
 }
        private static INotifyAction GetNotifyActionBySubscriptionType(ASC.Blogs.Core.SubscriptionType subscriptionType)
        {
            switch (subscriptionType)
            {
                case ASC.Blogs.Core.SubscriptionType.NewBlog:
                    return Constants.NewPost;

                case ASC.Blogs.Core.SubscriptionType.NewBlogPers:
                    return Constants.NewPostByAuthor;

                case ASC.Blogs.Core.SubscriptionType.NewComment:
                    return Constants.NewComment;

            }
            return null;
        }
示例#32
0
 public SecurityAdapter(ASC.Projects.Core.DataInterfaces.IDaoFactory factory, int projectId)
 {
     this.dao = factory.GetProjectDao();
     this.projectId = projectId;
 }
示例#33
0
        protected void ExecCasesDetailsView(ASC.CRM.Core.Entities.Cases targetCase)
        {
            var casesDetailsViewControl = (CasesDetailsView)LoadControl(CasesDetailsView.Location);
            casesDetailsViewControl.TargetCase = targetCase;
            CommonContainerHolder.Controls.Add(casesDetailsViewControl);

            var title = targetCase.Title.HtmlEncode();

            Master.CurrentPageCaption = title ;
            Master.CommonContainerHeader = Global.RenderItemHeaderWithMenu(title, EntityType.Case, CRMSecurity.IsPrivate(targetCase));

            Title = HeaderStringHelper.GetPageTitle(title);
        }
示例#34
0
        protected void ExecCasesActionView(ASC.CRM.Core.Entities.Cases targetCase)
        {
            var casesActionViewControl = (CasesActionView)LoadControl(CasesActionView.Location);

            casesActionViewControl.TargetCase = targetCase;
            CommonContainerHolder.Controls.Add(casesActionViewControl);

            var headerTitle = targetCase == null ? CRMCasesResource.CreateNewCase : String.Format(CRMCasesResource.EditCaseHeader, targetCase.Title);

            Master.CurrentPageCaption = headerTitle;
            Title = HeaderStringHelper.GetPageTitle(headerTitle);
        }
 public override void PostMethodCall(IApiMethodCall method, ASC.Api.Impl.ApiContext context, object methodResponce)
 {
     Sw.Stop();
     TryLog(LogEntry.Actions.AfterCall, method, context, null);
     base.PostMethodCall(method, context, methodResponce);
 }
 public override void ErrorMethodCall(IApiMethodCall method, ASC.Api.Impl.ApiContext context, Exception e)
 {
     Sw.Stop();
     TryLog(LogEntry.Actions.ErrorCall, method, context,e);
     base.ErrorMethodCall(method, context, e);
 }
 public void FormatMessage(ASC.Notify.Messages.INoticeMessage message, ITagValue[] tagsValues)
 {
     throw new NotImplementedException();
 }
示例#38
0
        protected void ExecInvoiceActionView(ASC.CRM.Core.Entities.Invoice targetInvoice, InvoiceActionType actionType)
        {
            var invoiceActionViewControl = (InvoiceActionView)LoadControl(InvoiceActionView.Location);

            invoiceActionViewControl.ActionType = actionType;
            invoiceActionViewControl.TargetInvoice = targetInvoice;

            CommonContainerHolder.Controls.Add(invoiceActionViewControl);

            string headerTitle;

            switch (actionType)
            {
                case InvoiceActionType.Create:
                    headerTitle = CRMInvoiceResource.CreateNewInvoice;
                    break;
                case InvoiceActionType.Edit:
                    headerTitle = String.Format(CRMInvoiceResource.EditInvoiceHeader, targetInvoice.Number);
                    break;
                case InvoiceActionType.Duplicate:
                    headerTitle = String.Format(CRMInvoiceResource.DuplicateInvoiceHeader, targetInvoice.Number);
                    break;
                default:
                    headerTitle = CRMInvoiceResource.CreateNewInvoice;
                    break;
            }

            Master.CurrentPageCaption = headerTitle;
            Title = HeaderStringHelper.GetPageTitle(headerTitle);
        }
示例#39
0
        protected void ExecInvoicePdfView(ASC.CRM.Core.Entities.Invoice targetInvoice)
        {
            var pdfFile = Global.GetInvoicePdfExistingOrCreate(targetInvoice);

            MessageService.Send(HttpContext.Current.Request, MessageAction.InvoiceDownloaded, targetInvoice.Number);

            Response.Redirect(CommonLinkUtility.GetFullAbsolutePath(pdfFile.FileDownloadUrl));
        }
示例#40
0
        protected void ExecInvoiceDetailsView(ASC.CRM.Core.Entities.Invoice targetInvoice)
        {
            var invoiceDetailsView = (InvoiceDetailsView)LoadControl(InvoiceDetailsView.Location);

            invoiceDetailsView.TargetInvoice = targetInvoice;
            CommonContainerHolder.Controls.Add(invoiceDetailsView);

            var title = targetInvoice.Number.HtmlEncode();

            Master.CurrentPageCaption = title;
            Master.CommonContainerHeader = Global.RenderItemHeaderWithMenu(title, EntityType.Invoice, false, true);
            Title = HeaderStringHelper.GetPageTitle(title);
        }
示例#41
-4
 public static ASC.Files.Core.File GetInvoicePdfExistingOrCreate(ASC.CRM.Core.Entities.Invoice invoice)
 {
     var existingFile = invoice.GetInvoiceFile();
     if (existingFile != null)
     {
         return existingFile;
     }
     else
     {
         var newFile = PdfCreator.CreateFile(invoice);
         invoice.FileID = Int32.Parse(newFile.ID.ToString());
         Global.DaoFactory.GetInvoiceDao().UpdateInvoiceFileID(invoice.ID, invoice.FileID);
         Global.DaoFactory.GetRelationshipEventDao().AttachFiles(invoice.ContactID, invoice.EntityType, invoice.EntityID, new[] { invoice.FileID });
         return newFile;
     }
 }