当前位置: 首页>>代码示例>>C#>>正文


C# Job.setCustomField方法代码示例

本文整理汇总了C#中Job.setCustomField方法的典型用法代码示例。如果您正苦于以下问题:C# Job.setCustomField方法的具体用法?C# Job.setCustomField怎么用?C# Job.setCustomField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Job的用法示例。


在下文中一共展示了Job.setCustomField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getNewJobList

        private List<Job> getNewJobList() {
            // Create a list of jobs and contacts to create
            List<Job> list = new List<Job>();
            for (int i = 1; i < JOB_COUNT; i++) {
                Job job = new Job();
                job.status = Job.OPEN; // means this is a new job
                job.owner = ""; // leave it blank for unassigned

                // Base Fields
                job.id = "JOBID" + i;
                job.status = Job.OPEN;
                job.owner = "John Smith"; // Make sure the owner field is set to an actual Upise user
                job.name = "Job Title " + i;
                job.note = "Job Description " + i;
                job.priority = Job.HIGHPRIORITY;
                job.duedate = DateTime.Now.AddHours(2);

                // Address
                job.street = "74 Union St";
                job.city = "Sydney";
                job.zipcode = "2060";
                job.state = "NSW";
                job.country = "Australia"; // no need to send country
                job.geo = "-33.842056,151.203757";

                // Custom Fields
                // note about custom fields : you need to declare the custom Field in the Jobs Web Application first and define their label and type first
                // and obtain their id,  for example F1, F2,...
                job.setCustomField("F13", "Unit 123"); // UNIT
                job.setCustomField("F3", "on the right"); // METER LOCATION
                job.setCustomField("F15", "9495 2984"); // Customer Phone
                job.setCustomField("F8", "Notes about the customer"); // Note
                job.setCustomField("F16", "Service Order#"); // Service Order
                job.setCustomField("F18", "Contract#"); // Contract #

                // Meter Information
                job.setCustomField("F1", "Gas"); // METER TYPE
                job.setCustomField("F6", "RTETC12345"); // METER NUMBER
                job.setCustomField("F7", "REF:3434"); // MAPREF
                job.setCustomField("F10", "some note"); // METER NOTES
                job.setCustomField("F11", "111"); // PREVIOUS READ

                // Control
                job.setCustomField("F17", "3"); // Number of Dials
                job.setCustomField("F19", "1:Meter Read|2:Location Updated"); //  Completed Options
                job.setCustomField("F20", "1:Locked|2:Customer not here|3:Dog"); // Skip Options
                
                // Add the job to the list
                list.Add(job);
            }
            return list;
        }
开发者ID:prestanneth,项目名称:UpviseSDK,代码行数:52,代码来源:JobSampleBatch2.cs

示例2: run

        public void run() {
            string token = Query.login("[email protected]", "demobiz");
            Query query = new Query(token);

            // 1. insert one job
            Job newjob = new Job();
            newjob.id = "ID1";
            newjob.status = Job.OPEN;
            newjob.name = "Maintain Air Conditining";
            newjob.note = "Verify gaz pressure";
            newjob.duedate = DateTime.Now.AddHours(2);
            newjob.owner = "John"; // if you want to assign a Job, set the Upvise user Display name here
            newjob.street = "1 infinite Loop";
            newjob.city = "Cupertino";
            newjob.zipcode = "";
            newjob.country = "USA";
            newjob.geo = "12,3.444"; // set the coordinates for the job
            newjob.priority = Job.HIGHPRIORITY; // High priority

            // set some custom fields values
            newjob.setCustomField("F1", "WATER");
            newjob.setCustomField("F2", "12");

            query.insert(Job.TABLE, newjob.toJson());

            // 2. Update the existing job and mark it complete
            Job updatedValues = new Job();
            updatedValues.status = Job.COMPLETED;
            updatedValues.checkout = DateTime.Now;
            updatedValues.checkoutnote = "Aircon is leaking, requirews further fixing";

            query.updateId(Job.TABLE, "ID1", updatedValues.toJson());

            // 3. Select All Completed Jobs
            JSONObject where = new JSONObject();
            where.put("status", Job.COMPLETED);
            JSONObject[] completedJobs = query.select(Job.TABLE, where);
            foreach (JSONObject obj in completedJobs) {
                Job job = Job.fromJson(obj);

                Console.Write("Checkout note: " + job.checkoutnote);
                Console.Write("Custom Field 1: " + job.getCustomField("F1"));
                Console.Write("Custom Field 2: " + job.getCustomField("F2"));
                
                // Download all photos for the Job
                File[] files = query.selectFiles(Job.TABLE, job.id);
                foreach (File file in files) {
                    if (file.mime == "image/jpeg") {
                        byte[] content = query.downloadFile(file.id);
                        string filename = @"c:\temp\" + file.name + ".jpeg";
                        System.IO.File.WriteAllBytes(filename, content);
                    }
                }

                // Get All forms for the Job
                JSONObject formWhere = new JSONObject();
                formWhere.put("linkedid", job.id);
                JSONObject[] forms = query.select(Form.TABLE, formWhere);
                foreach (JSONObject formObj in forms) {
                    Form form = Form.fromJson(formObj, query);
                    Console.WriteLine("Form : " + formObj.ToString());
                }
            }

            // 4. Delete completed Jobs in batch mode
            query.beginBatch();
            foreach (JSONObject obj in completedJobs) {
                string jobid = obj.getString("id");
                query.deleteId(Job.TABLE, jobid);
            }
            query.commitBatch();
        }
开发者ID:prestanneth,项目名称:UpviseSDK,代码行数:72,代码来源:JobSample.cs

示例3: loadJobsFromXml

        private void loadJobsFromXml(string filename) {
            // Create a list of jobs and contacts to create
            mJobList = new List<Job>();
            mContactList = new List<Contact>();

            // Load the local XML job file and parse all jobs
            Console.WriteLine("Loading and parsing Jobs from " + filename);
            XmlDocument doc = new XmlDocument();
            doc.Load(filename);

            XmlNodeList nodeList = doc.SelectNodes("/root/job");
            foreach (XmlNode node in nodeList) {
                Job job = new Job();
                job.status = Job.OPEN; // means this is a new job
                job.owner = ""; // leave it blank for unassigned

                // Base Fields
                job.id = node.SelectSingleNode("id").InnerText; // this must be a unique Job ID
                job.name = node.SelectSingleNode("name").InnerText; // job name or title
                job.note = node.SelectSingleNode("note").InnerText; // additional job description
                job.priority = (node.SelectSingleNode("priority").InnerText == "high") ? Job.HIGHPRIORITY : 0;
                //job.duedate = DateTime.Parse(node.SelectSingleNode("date").InnerText); // job scheduled date

                string strdate = node.SelectSingleNode("date").InnerText;
                job.duedate = DateTime.Parse(strdate); // job scheduled date
                
                job.duration = Convert.ToInt32(node.SelectSingleNode("duration").InnerText); // estimated duration in minutes

                // get the contact name and mobile
                Contact contact = new Contact();
                contact.name = node.SelectSingleNode("client/name").InnerText;
                contact.mobile = node.SelectSingleNode("client/mobile").InnerText;
                // if the contact is not yet in Upvise, add it to the list of contacts to create
                if (mUpviseContactIndex.ContainsKey(contact.name) == false) {
                    contact.id = Query.guid(contact.name);
                    job.contactid = contact.id;    
                    mContactList.Add(contact);
                } else {
                     // get the contact record ID from the index       
                    job.contactid = mUpviseContactIndex[contact.name];
                }

                // Address
                job.street = node.SelectSingleNode("address/street").InnerText;
                job.city = node.SelectSingleNode("address/city").InnerText;
                job.zipcode = node.SelectSingleNode("address/zipcode").InnerText;
                job.state = node.SelectSingleNode("address/state").InnerText;
                //job.country = node.SelectSingleNode("address/country").InnerText;
                job.geo = node.SelectSingleNode("address/geo").InnerText;

                // Add some custom fields
                // note about custom fields : you need to declare the custom Field in the Jobs Web Application first and define their label and type first
                job.setCustomField("F1", node.SelectSingleNode("field1").InnerText);
                job.setCustomField("F2", node.SelectSingleNode("field2").InnerText);

                // Add the job to the list
                mJobList.Add(job);
            }

            Console.WriteLine("found " + mJobList.Count + " jobs to create");
            Console.WriteLine("found " + mContactList.Count + " contacts to create");
        }
开发者ID:prestanneth,项目名称:UpviseSDK,代码行数:62,代码来源:JobSampleBatch.cs


注:本文中的Job.setCustomField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。