Exemplo n.º 1
0
        /// <summary>
        /// close a job by Desk
        /// </summary>
        /// <param name="strsql">sql sentence</param>
        /// <returns>0 or 1</returns>
        public static int closeByDesk(JobInfo job)
        {
            string strsql = string.Format("UPDATE `jobs` SET `desk`=0 WHERE id = 2", job.desk.UserId);

            return(SqliteHelper.ExecuteNoneQuery(strsql));
        }
Exemplo n.º 2
0
        /// <summary>
        /// set a job's priority
        /// </summary>
        /// <param name="strsql">sql sentence</param>
        /// <returns>0 or 1</returns>
        public static int setPriority(JobInfo job)
        {
            string strsql = string.Format("UPDATE `jobs` SET `priority`=0, WHERE id = 2", job.priority);

            return(SqliteHelper.ExecuteNoneQuery(strsql));
        }
Exemplo n.º 3
0
        public static IList <JobInfo> GetJobsBySQL(string strsql)
        {
            IList <JobInfo> jobs = new List <JobInfo>();
            DataTable       dt   = SqliteHelper.ExecuteTable(strsql);

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //to do: some fiels have been seperated from jobs

                    JobInfo job = new JobInfo();
                    job.id    = dt.Rows[i]["id"].ToString();
                    job.carNo = dt.Rows[i]["carNo"].ToString();

                    string customerId = dt.Rows[i]["customer"].ToString();
                    if (customerId != null && customerId.Length > 0)
                    {
                        job.customer = Sys_roleService.GetUserByiId(int.Parse(customerId));
                    }
                    job.jobDescription = dt.Rows[i]["jobDescription"].ToString();
                    try
                    {
                        job.createdate = DateTime.Parse(dt.Rows[i]["createdate"].ToString());
                    }
                    catch
                    {
                        job.createdate = DateTime.Now;
                    }

                    job.jobStatus = (JobStatus)int.Parse(dt.Rows[i]["jobStatus"].ToString());

                    job.priority = (Priority)int.Parse(dt.Rows[i]["priority"].ToString());

                    string type = dt.Rows[i]["jobType"].ToString();
                    if (type != null && type.Length > 0)
                    {
                        job.jobType = (JobType)int.Parse(type);
                    }


                    string resolve = dt.Rows[i]["resolve"].ToString();
                    if (resolve != null && resolve.Length > 0)
                    {
                        job.resolve = (ResolveStatus)int.Parse(resolve);
                    }
                    //outer key
                    string deskId = dt.Rows[i]["desk"].ToString();
                    if (deskId != null && deskId.Length > 0)
                    {
                        job.desk = Sys_roleService.GetUserByiId(int.Parse(deskId));
                    }

                    string managerId = dt.Rows[i]["manager"].ToString();
                    if (managerId != null && managerId.Length > 0)
                    {
                        job.manager = Sys_roleService.GetUserByiId(int.Parse(managerId));
                    }

                    string workerId = dt.Rows[i]["worker"].ToString();
                    if (workerId != null && workerId.Length > 0)
                    {
                        job.worker = Sys_roleService.GetUserByiId(int.Parse(workerId));
                    }
                    //add outlet key
                    string outletID = dt.Rows[i]["outlet"].ToString();
                    if (outletID != null && outletID.Length > 0)
                    {
                        job.outlet = sys_outletService.GetOutletbyotID(int.Parse(outletID));
                    }

                    try
                    {
                        job.closedate = DateTime.Parse(dt.Rows[i]["closedate"].ToString());
                    }
                    catch
                    {
                        job.closedate = DateTime.Now;
                    }

                    job.comment = dt.Rows[i]["comment"].ToString();
                    jobs.Add(job);
                }
            }

            return(jobs);
        }