예제 #1
0
        /// <summary>
        /// 根据启动类型自动创建系统作业,但缺省了方案ID,不成功时返回null
        /// </summary>
        /// <param name="starttype"></param>
        /// <returns></returns>
        public static QcJob Get_CreatQuickJob(string starttype)
        {
            QcTask task = QcTask.Get_CreatQuickTask();

            if (task != null)
            {
                QcJob chekjob = QcJob.GetJob(task).Where(t => t["启动类型"] == starttype).FirstOrDefault();
                if (chekjob == null)
                {
                    QcJob job = new QcJob(task);
                    job.Name     = string.Format("我的 {0} 快速作业", starttype);
                    job["启动类型"]  = starttype;
                    job["作业员"]   = QcUser.User.UserID;
                    job["作业优先级"] = "1";
                    job["作业状态"]  = "未启动";
                    job["作业描述"]  = "该作业为系统自动分配的快速作业";
                    job["备注"]    = "#*9999*#";
                    job.Update();
                    return(job);
                }
                else
                {
                    return(chekjob);
                }
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public static bool Regsister(string username, string password, string name, string sex, DateTime birthday, string tel, string part, DateTime worktime, string address, string content, string status = "注册")
        {
            if (QcUser.Users.Any(t => t.UserName == username || t.姓名 == name))
            {
                return(false);
            }
            QcUser user = new QcUser();

            user.UserName  = username;
            user.部门        = part;
            user.姓名        = name;
            user["用户密码"]   = password;
            user["性别"]     = sex;
            user["出生日期"]   = birthday.ToQcDateString();
            user["参加工作时间"] = worktime.ToQcDateString();
            user["联系电话"]   = tel;
            user["通讯地址"]   = address;
            user["备注"]     = content;
            user.UserID    = QcUser.GetNextCode();
            user["状态"]     = status;
            //user["状态"] = "启用";
            bool ret = user.Update();

            if (ret)
            {
                user.AddRole("项目负责人");
                user.AddRole("任务负责人");
                user.AddRole("作业员");
            }
            //if (QcProject.GetProjects("").Any(t => t.Name == "快速项目") == false)
            //{
            //    QcProject prj = new QcProject();
            //    prj["项目名称"] = "快速项目";
            //    prj["项目负责人"] = "sys";
            //    prj["承担部门"] = "临时";
            //    prj["项目来源"] = "其它";
            //    prj["项目类型"] = "其它";
            //    prj["创建人"] = "sys";
            //    if (prj.Update())
            //    {
            //        QcTask task = new QcTask(prj);
            //        task.Name = "快速任务";
            //        task["任务负责人"] = "sys";
            //        task["创建人"] = "sys";
            //        task["任务优先级"] = "1";
            //        task["任务状态"] = "未启动";
            //        task.Update();
            //    }
            //}
            QcTask.Get_CreatQuickTask();
            QcMsgPoster.PostMeassage(user.Code, user.tablename, user.CodeField, NodeChangeType.Create);
            return(ret);
        }
예제 #3
0
        /// <summary>
        /// 根据名称,类型,方案创建作业,不成功时返回null
        /// </summary>
        /// <param name="jobname"></param>
        /// <param name="starttype"></param>
        /// <param name="chkprjid"></param>
        /// <returns></returns>
        public static QcJob CreatQuickJob(string jobname, string starttype, string productlevelcode, string producttypecode, string chkprjid)
        {
            QcTask task = QcTask.Get_CreatQuickTask();

            if (task != null)
            {
                QcJob job = new QcJob(task);
                job.Name      = jobname;
                job["启动类型"]   = starttype;
                job["作业员"]    = QcUser.User.UserID;
                job["产品级别编码"] = productlevelcode;
                job["产品类别编码"] = producttypecode;
                job["方案ID"]   = chkprjid;
                job["作业优先级"]  = "1";
                job["作业状态"]   = "未启动";
                job["修改日期"]   = DateTime.Now.ToString();
                job.Update();
                return(job);
            }
            else
            {
                return(null);
            }
        }