예제 #1
0
        public static async Task <bool> UploadImage(string listName, string listName2, string imageName, Bitmap bitmap, int incidentId, int inspectionId, int roomId)
        {
            bool success = false;

            try
            {
                bool uploadSuccess = await ListClient.UploadPhoto(listName, imageName, bitmap);

                if (uploadSuccess)
                {
                    int fileId = await ListClient.GetFileId(listName, imageName);

                    if (fileId > 0)
                    {
                        string type     = "SP.Data.RepairPhotosItem";
                        string metadata = string.Format("'sl_incidentIDId':{0},'sl_inspectionIDId':{1},'sl_roomIDId':{2}", incidentId, inspectionId, roomId);
                        success = await ListClient.UpdateListItem(type, metadata, listName2, fileId);
                    }
                }
            }
            catch (Exception)
            {
                success = false;
            }

            return(success);
        }
예제 #2
0
        public static async Task <bool> UploadRepairWorkFlowTask(int taskId)
        {
            bool success = false;

            try
            {
                string type     = "SP.Data.Incident_x0020_Workflow_x0020_TasksListItem";
                string metadata = "'PercentComplete':1,'Status':'Completed'";
                success = await ListClient.UpdateListItem(type, metadata, "Incident%20Workflow%20Tasks", taskId);
            }
            catch (Exception)
            {
                success = false;
            }

            return(success);
        }
예제 #3
0
        public static async Task <bool> UploadRepairComplete(int incidentId)
        {
            bool success = false;

            try
            {
                string type     = "SP.Data.IncidentsListItem";
                string metadata = string.Format("'sl_repairCompleted':'{0}','sl_status':'Repair Pending Approval'", DateTime.Now.ToString("yyyy/MM/dd"));
                success = await ListClient.UpdateListItem(type, metadata, "Incidents", incidentId);
            }
            catch (Exception)
            {
                success = false;
            }

            return(success);
        }
예제 #4
0
        public static async Task <bool> UploadRepairComments(int incidentId, string comments)
        {
            bool success = false;

            try
            {
                string type     = "SP.Data.IncidentsListItem";
                string metadata = string.Format("'sl_repairComments':'{0}'", comments);
                success = await ListClient.UpdateListItem(type, metadata, "Incidents", incidentId);
            }
            catch (Exception)
            {
                success = false;
            }

            return(success);
        }