コード例 #1
0
        //
        public FeedAttachmentVideo(ActivityAttachment attachment, ulong actionId)
        {
            _video                = Videos.GetById(attachment.id);
            attachment_id         = attachment.id;
            attachment_video_type = _video.GetVIdeoType();
            attachment_type       = "video";
            title = _video.title;
            body  = HttpUtility.HtmlDecode(_video.description);
            attachment_video_url = _video.GetVideoUrl(ServiceUrlPrefixes.CouldFront);
            if (_video.type == "fb")
            {
                Dictionary <string, string> data = JsonConvert.DeserializeObject <Dictionary <string, string> >(_video.code);
                image_main = new FeedImage()
                {
                    src = data["thumb"], size = new FeedImageSize()
                    {
                        height = 300, width = 300
                    }
                };
                attachment_video_code = "mp4";
            }
            else
            {
                attachment_video_code = _video.code;
                image_main            = _video.photo_id > 0 ? new FeedImage(_video.photo_id) : null;
            }
            content_url = $"https://beta.koobeca.com/view.php?action_id={actionId}";
            //content_url = uri = $"https://beta.koobeca.com/videos/{_video.owner_id}/{_video.video_id}/video";

            mode = (uint)(attachment.mode ? 1 : 0);
        }
コード例 #2
0
        public FeedAttachmentCore(ActivityAttachment attachment, ulong actionId)
        {
            var coreLink = CoreLinks.GetById(attachment.id);

            title = coreLink.title;
            body  = HttpUtility.HtmlDecode(coreLink.description);
            //uri = $"https://beta.koobeca.com/core/link/index/id/{coreLink.link_id}/key/{Md5.CalculateMd5Hash(coreLink.link_id + coreLink.uri)}/action_id/{actionId}";
            uri        = $"https://beta.koobeca.com/view.php?action_id={actionId}";
            image_main = coreLink.photo_id > 0 ? new FeedImage(coreLink.photo_id) : null;
            if (image_main == null)   // && !string.IsNullOrEmpty(coreLink.@params)){
            {
                var iframely = coreLink.GetIFramely();
                if (iframely != null)
                {
                    try {
                        image_main = new FeedImage(iframely);
                    }
                    catch {
                        Logger.Instance.Error($"Bad iframley in corelink {coreLink.link_id} : {coreLink.@params}");
                    }
                }
            }

            attachment_id = attachment.id;
            mode          = (uint)(attachment.mode ? 1 : 0);
        }
コード例 #3
0
        public async Task <int> DeleteAttachment(long id)
        {
            ActivityAttachment model = await DbContext.DealTrackingActivityAttachments.FirstOrDefaultAsync(d => d.Id.Equals(id) && d.IsDeleted.Equals(false));

            EntityExtension.FlagForDelete(model, IdentityService.Username, "deal-tracking-service", true);
            DbContext.DealTrackingActivityAttachments.Update(model);

            return(await DbContext.SaveChangesAsync());
        }
コード例 #4
0
        //
        public FeedAttachmentSticker(ActivityAttachment attachment, ulong actionId)
        {
            _sticker        = Stickers.GetById(attachment.id);
            attachment_id   = attachment.id;
            attachment_type = "sitereaction_sticker";
            title           = _sticker.title;

            uri        = $"https://beta.koobeca.com/view.php?action_id={actionId}";
            image_main = _sticker.file_id > 0 ? new FeedImage(_sticker.file_id) : null;
            mode       = (uint)(attachment.mode ? 1 : 0);
        }
コード例 #5
0
        //
        public FeedAttachmentPhoto(ActivityAttachment attachment, ulong actionId)
        {
            _photo          = AlbumPhotos.GetById(attachment.id);
            attachment_id   = attachment.id;
            attachment_type = "album_photo";
            title           = _photo.title;
            body            = HttpUtility.HtmlDecode(_photo.description);

            //uri = $"https://beta.koobeca.com/advancedalbums/photo/view/album_id/{_photo.album_id}/photo_id/{_photo.photo_id}";
            //uri = $"https://beta.koobeca.com/core/link/index/action_id/{actionId}";
            uri        = $"https://beta.koobeca.com/view.php?action_id={actionId}";
            image_main = _photo.file_id > 0 ? new FeedImage(_photo.file_id) : null;
            mode       = (uint)(attachment.mode ? 1 : 0);
        }
コード例 #6
0
        private void SetAttachmentData(ActivityAttachment activityAttachment)
        {
            var iface = activityAttachment.GetActivityObject();

            data["type"]        = activityAttachment.type;
            data["title"]       = iface.GetObjectTitle();
            data["description"] = iface.GetObjectDesctiption();
            //data["url"] = HttpUtility.UrlEncode(coreLink.uri);
            if (iface.GetStorageFileId() > 0)
            {
                var storage   = Storages.GetByFileId(iface.GetStorageFileId());
                var imageSize = JsonConvert.DeserializeObject <FeedImageSize>(storage.@params);
                data["img"]        = ServiceUrlPrefixes.CouldFront + storage.storage_path;
                data["img_width"]  = imageSize.width.ToString();
                data["img_height"] = imageSize.height.ToString();
            }

            if (iface is Video)
            {
                var video = iface as Video;
                data["video_type"] = video.type;
                if (video.type == "fb")
                {
                    Dictionary <string, string> code = JsonConvert.DeserializeObject <Dictionary <string, string> >(video.code);
                    data["img"]        = code["thumb"];
                    data["img_width"]  = "600";
                    data["img_height"] = "600";
                }
                //else
                //{
                data["video_code"] = video.code;
                data["url"]        = video.GetVideoUrl(ServiceUrlPrefixes.CouldFront);
                //}
                //if (video.file_id > 0)
                //{
                //    var storage = Storages.GetByFileId(video.file_id);
                //    data["url"] = HttpUtility.UrlEncode(ServiceUrlPrefixes.CouldFront + storage.storage_path);
                //}
            }

            if (iface is CoreLink)
            {
                var link = iface as CoreLink;
                data["url"] = link.uri;
            }
        }
コード例 #7
0
 public static ulong Add(ActivityAttachment newAttachment)
 {
     Console.WriteLine($"adding attachment to table:{JsonConvert.SerializeObject(newAttachment)}");
     return(DbUtils.ConnectAndExecute(conn => {
         var query = "INSERT INTO engine4_activity_attachments(action_id,id,type,mode) " +
                     "VALUES (@action_id,@id,@type,@mode)";
         var cmd = new MySqlCommand(query, conn);
         cmd.Parameters.AddWithValue("action_id", newAttachment.action_id);
         cmd.Parameters.AddWithValue("id", newAttachment.id);
         cmd.Parameters.AddWithValue("type", newAttachment.type);
         cmd.Parameters.AddWithValue("mode", newAttachment.mode);
         var rc = cmd.ExecuteNonQuery();
         cmd.CommandText = "Select @@Identity";
         var attachmentId = (ulong)cmd.ExecuteScalar();
         return attachmentId;
     }));
 }
コード例 #8
0
        public static CommentAttachment Create(Comment comment, ulong action_id)
        {
            CommentAttachment attachment = null;

            if (!string.IsNullOrEmpty(comment.attachment_type))
            {
                ActivityAttachment attach = new ActivityAttachment()
                {
                    id = (uint)comment.attachment_id, type = comment.attachment_type, mode = true
                };
                //var attach = ActivityAttachments.GetByTypeAndId((comment.attachment_type,(uint)comment.attachment_id)).FirstOrDefault();
                var feedAttachment = FeedAttachmentFactory.Create(attach, action_id);
                attachment = new CommentAttachment(feedAttachment);
            }

            return(attachment);
        }
コード例 #9
0
        public static FeedAttachment Create(ActivityAttachment attachment, ulong actionId)
        {
            switch (attachment.type)
            {
            case "video":
                return(new FeedAttachmentVideo(attachment, actionId));

            case "core_link":
                return(new FeedAttachmentCore(attachment, actionId));

            case "album_photo":
                return(new FeedAttachmentPhoto(attachment, actionId));

            case "sitereaction_sticker":
                return(new FeedAttachmentSticker(attachment, actionId));

            default:
                return(null);    // new FeedAttachment(attachment);
            }
        }
コード例 #10
0
        private void AddVideoAttachmentToActivity(Video newVideo, Activity activity)
        {
            newVideo.video_id = (uint)Videos.Add(newVideo);
            var attachment = new ActivityAttachment()
            {
                action_id = (uint)activity.ActivityId,
                id        = newVideo.video_id,
                type      = "video",
                mode      = true
            };

            attachment.attachment_id = (uint)ActivityAttachments.Add(attachment);

            activity.RawActivity.Attachments = new List <ActivityAttachment>();
            activity.RawActivity.Attachments.Add(attachment);
            activity.RawActivity.attachment_count = 1;
            activity.RawActivity.type             = "post_self_video";
            activityModified = true;
            Logger.Instance.Debug($"Attached FB video to {activity.ActivityId}");
        }
コード例 #11
0
        public IHttpActionResult AddClientRequest()
        {
            try
            {
                using (MaxMasterDbEntities db = new MaxMasterDbEntities())
                {
                    var form         = HttpContext.Current.Request.Form;
                    var clientId     = form.Get("clientId");
                    var departmentId = form.Get("departmentId");
                    int orgId        = Convert.ToInt32(form.Get("OrgId"));
                    var categoryId   = form.Get("categoryId");
                    var u            = User.Identity.GetUserId();

                    Activity activity = new Activity();

                    var user      = db.Clients.Where(x => x.AspNetUserId == u && x.Active == true).FirstOrDefault();
                    var createdby = user.Id;

                    var clientOrg = user.OrgId;

                    var emp = db.Employees.Where(x => x.Role_Id == "8").FirstOrDefault();
                    if (emp != null)
                    {
                        activity.AssignedTo = emp.AspNetUserId;
                        activity.TaskOwner  = emp.AspNetUserId;
                    }

                    activity.CreatedBy  = User.Identity.GetUserId();
                    activity.TaskType   = "Client";
                    activity.Client_Id  = user.AspNetUserId;
                    activity.Project_Id = Convert.ToInt32(form.Get("projectId"));
                    activity.EDOC       = DateTime.Now.AddDays(2);

                    activity.TaskId = RandomString(4, orgId, createdby, true);
                    db.Activities.Add(activity);

                    ActivitiesLog activityLog = new ActivitiesLog();

                    activityLog.Status      = activity.Status;
                    activityLog.Description = activity.Description;
                    activityLog.TaskDate    = MasterDataController.GetIndianTime(DateTime.UtcNow);
                    activityLog.AssignedBy  = activity.CreatedBy;
                    activityLog.AssignedTo  = activity.TaskOwner;

                    activity.ActivitiesLogs.Add(activityLog);

                    var files = HttpContext.Current.Request.Files;

                    var fileAttachments = new List <HttpPostedFile>();

                    for (int i = 0; i < files.Count; i++)
                    {
                        fileAttachments.Add(files[i]);
                    }

                    foreach (var file in fileAttachments)
                    {
                        var fileDirecory = HttpContext.Current.Server.MapPath("~/Task");

                        if (!Directory.Exists(fileDirecory))
                        {
                            Directory.CreateDirectory(fileDirecory);
                        }

                        var fileName = file.FileName;
                        var filePath = Path.Combine(fileDirecory, fileName);
                        file.SaveAs(filePath);

                        ActivityAttachment actAttachments = new ActivityAttachment();

                        actAttachments.AttachmentURL = Path.Combine(ConfigurationManager.AppSettings["ApiUrl"], "Task", fileName);
                        actAttachments.Name          = Path.GetFileNameWithoutExtension(file.FileName);
                        activityLog.ActivityAttachments.Add(actAttachments);
                    }


                    var    from   = "";
                    var    to     = "";
                    string name   = "";
                    var    taskId = activity.TaskId;

                    var client = db.Clients.Where(x => x.AspNetUserId == activity.CreatedBy && x.Active == true).FirstOrDefault();
                    to   = client.Email;
                    name = client.Name;


                    var empl = db.Employees.Where(x => x.AspNetUserId == activity.AssignedTo && x.Active == true).FirstOrDefault();
                    to   = empl.Email;
                    name = empl.FirstName + " " + empl.LastName;

                    string subject = "You have created a new ticket with ticket Id #" + taskId;

                    var body = @"<div style=""border: 1px solid gray;margin-top:2px; margin-right: 2px;padding: 9px;"" > 
                                     <p> Dear " + name + ", </p>" +
                               "<p> Greetings! Thank you for contacting our support team. We received your request in our system and we have started working on priority.</p>" +
                               "<p> We will approach you soon if we require any further details to probe and expedite on the issue. Please allow us some time to give you an update on the progress on resolution.Your patience till then is much appreciated.</p> " +
                               "<p> We encourage you to kindly use our support portal http://ourclientSupport.azurewebsites.net for reporting issues/Service Requests with support team or to seek any further updates on your ticket. </p>" +
                               "<p> If you are experiencing any delays or for any further assistance you are feel free to contact on below numbers:</p>" +
                               "<p> CUSTOMER SERVICE: 9 66 67 24 365 </p>" +
                               " </div>";
                    bool sendmail = new EmailController().SendEmail(from, "Task Management System", to, subject, body);

                    db.SaveChanges();
                }
                return(Ok());
            }
            catch (Exception ex)
            {
                return(Content(System.Net.HttpStatusCode.InternalServerError, "An error occured please try again later"));
            }
        }