Example #1
0
        public ActionResult getprojectleadreport(
            string userfilter,
            string userlist,
            string payrollperiod,
            string project,
            MC2DateTimeValue startdate,
            MC2DateTimeValue enddate)
        {
            // Send request to TroHelpsersHandler. Needs to be handled in the server because frontend
            // has no access to audit data.

            var projectLeadReportMessage = new RCMessage("tro_getprojectleadreport");

            DataTree handler = projectLeadReportMessage.Handlers["trohelpershandler"];

            handler["user"]          = Runtime.SessionManager.CurrentUser[DBQuery.Id];
            handler["userfilter"]    = userfilter;
            handler["userlist"]      = userlist;
            handler["payrollperiod"] = payrollperiod;
            handler["startdate"]     = startdate;
            handler["enddate"]       = enddate;
            handler["project"]       = project;

            RCResponse response = Runtime.SendRemoteMessage(projectLeadReportMessage);

            // Return documents as arrays
            string[] documentTypes = { "timesheetentry", "dayentry", "articleentry" };
            foreach (var documentType in documentTypes)
            {
                response["handlers"]["trohelpershandler"]["report"][documentType].JsonSerializationType = JsonSerializationType.ChildrenAsArrays;
            }

            return(new AjaxResult(response));
        }
Example #2
0
        public ActionResult revert(string payrollperiod, string user = null)
        {
            logger.LogInfo("Received a request to revert exported payroll items to unexported status.", payrollperiod);

            if (string.IsNullOrEmpty(payrollperiod) && string.IsNullOrEmpty(user))
            {
                logger.LogError("Payroll period and user are missing from payroll revert request");
                return(new AjaxResult("error: No payroll period or user specified."));
            }

            var      revertPayrollData = new RCMessage("payrollrevertexport");
            DataTree payrollHandler    = revertPayrollData.Handlers["payrollintegrationhandler"];

            if (!string.IsNullOrEmpty(payrollperiod))
            {
                payrollHandler["payrollperiod"] = payrollperiod;
            }

            if (!string.IsNullOrEmpty(user))
            {
                payrollHandler["user"] = user;
            }

            Runtime.SendRemoteMessage(revertPayrollData);
            return(new AjaxResult(""));
        }
Example #3
0
        public ActionResult restoredatabase(string dumpname)
        {
            var restoreMessage = new RCMessage("restoredb");

            restoreMessage.Handlers[MongoDBHandlerConstants.mongodbhandler]["dumpname"] = dumpname;
            RCResponse response = Runtime.RemoteConnection.ProcessMessage(restoreMessage);

            return(View());
        }
        public override RCMessage Rcmessage(NSIndexPath indexPath)
        {
            DBMessage dbmessage = MyDBMessage(indexPath);

            string messageId = dbmessage.objectId;

            System.Diagnostics.Debug.WriteLine($"{indexPath.Section}: {messageId}");
            if (rcmessages[messageId] == null)
            {
                RCMessage rcmessage = new RCMessage();

                bool incoming = dbmessage.senderId.Equals("Naxam");

                if (dbmessage.type.Equals("text"))
                {
                    rcmessage = new RCMessage(dbmessage.text, incoming);
                }

                if (dbmessage.type.Equals("picture"))
                {
                    NSUrl myUrl = new NSUrl(dbmessage.picture);

                    rcmessage        = new RCMessage(null, dbmessage.picture_width, dbmessage.picture_height, incoming);
                    rcmessage.Status = (int)MessageStatus.Succeed;

                    NSUrlSession.SharedSession.CreateDataTaskAsync(myUrl)
                    .ContinueWith(t =>
                    {
                        if (t.IsFaulted)
                        {
                            return;
                        }

                        rcmessage.Picture_image = UIImage.LoadFromData(t.Result.Data);
                    });
                }

                if (dbmessage.type.Equals("video"))
                {
                    rcmessage = new RCMessage(dbmessage.video_path, dbmessage.video_duration, incoming);
                    rcmessage.Video_thumbnail = dbmessage.video_image;
                    rcmessage.Status          = (int)MessageStatus.Succeed;
                }

                if (dbmessage.type.Equals("location"))
                {
                    rcmessage = new RCMessage(dbmessage.latitude, dbmessage.longitude, incoming, HandleAction);
                }

                rcmessages[messageId] = rcmessage;
            }

            return((RCMessage)rcmessages[messageId]);
        }
        public override string TextSectionFooter(NSIndexPath indexPath)
        {
            RCMessage rcmessage = Rcmessage(indexPath);

            if (rcmessage.Outgoing)
            {
                DBMessage dbmessage = MyDBMessage(indexPath);
                return((dbmessage.createdAt > lastRead) ? dbmessage.status : "Read");
            }

            return(null);
        }
Example #6
0
        public ActionResult setnowfortesting(string now)
        {
            var setNowMessage = new RCMessage("setnowfortesting");

            MC2DateTimeValue dtNow = (MC2DateTimeValue)MC2DateTimeValue.TryConvertValueFromString(now);

            MC2DateTimeValue.OverrideNow(dtNow);

            setNowMessage.Handlers[MongoDBHandlerConstants.mongodbhandler]["now"] = dtNow;
            RCResponse response = Runtime.RemoteConnection.ProcessMessage(setNowMessage);

            return(View());
        }
Example #7
0
        public ActionResult setpassword(DataTree formData)
        {
            string password = formData["password"];
            string user     = formData["user"];

            var setPasswordMessage = new RCMessage(MongoDBHandlerConstants.mdbsetpassword);

            setPasswordMessage.Handlers[MongoDBHandlerConstants.mongodbhandler][MongoDBHandlerConstants.userid]   = user;
            setPasswordMessage.Handlers[MongoDBHandlerConstants.mongodbhandler][MongoDBHandlerConstants.password] = password;

            Runtime.SendRemoteMessage(setPasswordMessage);

            return(Redirect(Runtime.HistoryManager.GetPreviousAddress()));
        }
        public override void ActionTapBubble(NSIndexPath indexPath)
        {
            DBMessage dbmessage = MyDBMessage(indexPath);
            RCMessage rcmessage = Rcmessage(indexPath);

            if (rcmessage.Type == (int)MessageType.Picture)
            {
                var storyboard = UIStoryboard.FromName("Main", NSBundle.MainBundle).InstantiateViewController("PictureView") as PictureView;
                storyboard.pathImage = rcmessage.Picture_image;
                this.NavigationController.PushViewController(storyboard, true);
            }

            if (rcmessage.Type == (int)MessageType.Video)
            {
                var storyboard = UIStoryboard.FromName("Main", NSBundle.MainBundle).InstantiateViewController("VideoView") as VideoView;
                storyboard.pathVideo = rcmessage.Video_path;
                this.NavigationController.PushViewController(storyboard, true);
            }
        }
Example #9
0
        public ActionResult addproject(DataTree projectData, string securitytoken)
        {
            if (securityToken == null)
            {
                return(new AjaxResult("error:security token missing"));
            }

            if (securitytoken != this.securityToken)
            {
                return(new AjaxResult("error:invalid security token"));
            }

            var message = new RCMessage("addproject");

            message.Handlers["axintegrationhandler"]["projectdata"] = projectData;
            Runtime.SendRemoteMessage(message);

            return(new AjaxResult("success"));
        }
Example #10
0
        public AjaxResult refreshdisplaynames(string collection, int page, int documentsperpage)
        {
            var refreshMessage = new RCMessage(MongoDBHandlerConstants.mdbrefreshdisplaynames);

            DataTree handler = refreshMessage.Handlers[MongoDBHandlerConstants.mongodbhandler];

            handler[MongoDBHandlerConstants.collection] = collection;
            handler[MongoDBHandlerConstants.skip]       = page * documentsperpage;
            handler[MongoDBHandlerConstants.limit]      = documentsperpage;

            RCResponse response = Runtime.RemoteConnection.ProcessMessageAsync(refreshMessage).Result;

            DataTree handledDocuments = response.Handlers[MongoDBHandlerConstants.mongodbhandler];

            handledDocuments[MongoDBHandlerConstants.documentsprocessed].JsonSerializationType = JsonSerializationType.ChildrenAsArrays;
            handledDocuments[MongoDBHandlerConstants.documentsfailed].JsonSerializationType    = JsonSerializationType.ChildrenAsArrays;

            return(new AjaxResult(handledDocuments));
        }
Example #11
0
 public override void OnRCIMReceiveMessage(RCMessage message, int left)
 {
 }
Example #12
0
        public override void OnRCIMReceiveMessage(RCMessage message, int left)
        {

        }