public static bool applyItem(String itemid,String username,int actorUserId) { try { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_GZL_Item item = dc.t_GZL_Item.Where(i => i.ItemId == Convert.ToInt32(itemid)).Single(); t_GZL_TaskList task = dc.t_GZL_TaskList.Where(t => t.itemGuid == item.itemGuid).Single(); t_GZL_Actor actor = dc.t_GZL_Actor.Where(a => a.actorId == task.actorId).Single(); int sortNo = (int)actor.sortNo; var actor_next = dc.t_GZL_Actor.Where(a => a.routId == actor.routId && a.sortNo == sortNo + 1); if (actor_next.Count() != 0)//还有下一步流程 { task.actorId = actor_next.Single().actorId; item.State = "待审批"; //修改任务状态 t_GZL_TaskHistory history = new t_GZL_TaskHistory();//插入历史记录 history.actorId = actor.actorId; history.createDate = System.DateTime.Now; history.itemGuid = item.itemGuid; history.itemId = item.ItemId; history.operatorName = username; history.operatorUserId = item.ApplyUserId; history.action = "送审"; dc.t_GZL_TaskHistory.InsertOnSubmit(history); var has_actuser = dc.t_GZL_actorUser.Where(u => u.actorId == task.actorId && u.itemGuid == item.itemGuid && u.operateUserId == actorUserId && u.taskId == task.taskId); if (has_actuser != null && has_actuser.Count() > 0) { } else//第一次申请则插入执行人,否则用原有 { t_GZL_actorUser actUser = new t_GZL_actorUser();//插入下一步执行的人 actUser.actorId = task.actorId; actUser.itemGuid = item.itemGuid; actUser.itemId = item.ItemId; actUser.operateUserId = actorUserId; actUser.taskId = task.taskId; dc.t_GZL_actorUser.InsertOnSubmit(actUser); } t_User_Task userTask = new t_User_Task();//插入下一步执行人的任务,用于提醒 userTask.description = "您有一个待审批的采购项目"; userTask.isClick = false; userTask.url = "/Application/GZL/CG/ApplyApprove.aspx"; userTask.createtime = DateTime.Now; userTask.userid = actorUserId; dc.t_User_Task.InsertOnSubmit(userTask); dc.SubmitChanges(); return true; } else return false; } }catch (Exception ex) { throw new Exception("送审错误:"+ ex.Message); } }
public static void deleteRecord(int id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { KQ_SpecialRemark s = dc.KQ_SpecialRemark.Where(i => i.Id == id).Single(); dc.KQ_SpecialRemark.DeleteOnSubmit(s); dc.SubmitChanges(); } }
public static bool createDepartment(Department dep) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.Department.InsertOnSubmit(dep); dc.SubmitChanges(); return true; } }
public static bool insertTaskHistory(t_GZL_TaskHistory history) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_GZL_TaskHistory.InsertOnSubmit(history); dc.SubmitChanges(); return true; } }
public static bool createRout(t_GZL_Rout rout) { using(DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_GZL_Rout.InsertOnSubmit(rout); dc.SubmitChanges(); return true; } }
public static void delete(int id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_Sys sys = dc.t_Sys.Where(i => i.Id == id).Single(); dc.t_Sys.DeleteOnSubmit(sys); dc.SubmitChanges(); } }
public static bool insertActorUser(t_GZL_actorUser actorUser) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_GZL_actorUser.InsertOnSubmit(actorUser); dc.SubmitChanges(); return true; } }
public static bool DeleteUserById(String id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.DeleteUser(Convert.ToInt32(id)); dc.SubmitChanges(); return true; } }
public static bool createItem(t_GZL_Item item) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_GZL_Item.InsertOnSubmit(item); dc.SubmitChanges(); return true; } }
public static bool addShift(KQ_Shift sh) { using(DataClassesEduDataContext dc= new DataClassesEduDataContext()) { dc.KQ_Shift.InsertOnSubmit(sh); dc.SubmitChanges(); return true; } }
public static bool insertTask(t_GZL_TaskList task) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_GZL_TaskList.InsertOnSubmit(task); dc.SubmitChanges(); return true; } }
public static bool createRole(Roles role) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.Roles.InsertOnSubmit(role); dc.SubmitChanges(); return true; } }
public static bool insertWorkPlan(t_Work_Plan plan) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_Work_Plan.InsertOnSubmit(plan); dc.SubmitChanges(); return true; } }
public static void setUserToTeacherGroup(int userid,int teacherGroupId) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { Users user = dc.Users.Where(u => u.Key == userid).Single(); user.TeacherGroupId = teacherGroupId; dc.SubmitChanges(); } }
public static bool createTeacherGroup(t_Teacher_Group group) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_Teacher_Group.InsertOnSubmit(group); dc.SubmitChanges(); return true; } }
public static void deleteMenu(int id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_Menu m = dc.t_Menu.Where(u => u.Id == id).Single(); dc.t_Menu.DeleteOnSubmit(m); dc.SubmitChanges(); } }
public static bool createMenu(t_Menu menu) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_Menu.InsertOnSubmit(menu); dc.SubmitChanges(); return true; } }
public static bool createFormPurchase(t_Form_Purchase form) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { dc.t_Form_Purchase.InsertOnSubmit(form); dc.SubmitChanges(); return true; } }
public static bool deleteRoleUserById(String id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { User_Role ur = dc.User_Role.Where(u => u.Key == Convert.ToInt32(id)).Single(); dc.User_Role.DeleteOnSubmit(ur); dc.SubmitChanges(); return true; } }
public static bool deleteTeacherGroupById(String id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_Teacher_Group group = dc.t_Teacher_Group.Where(d => d.Id == Convert.ToInt32(id)).Single(); dc.t_Teacher_Group.DeleteOnSubmit(group); dc.SubmitChanges(); return true; } }
public static bool updateRoutState(int id,String state) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_GZL_Rout rout = dc.t_GZL_Rout.Where(r => r.routId == id).Single(); rout.State = state; dc.SubmitChanges(); return true; } }
public static bool deleteShift(string id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { KQ_Shift sh = dc.KQ_Shift.Where(k => k.Id == Convert.ToInt32(id)).Single(); dc.KQ_Shift.DeleteOnSubmit(sh); dc.SubmitChanges(); return true; } }
public static t_User_Task rout(int id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_User_Task task = dc.t_User_Task.Where(u => u.Id == id).Single(); task.isClick = true; dc.SubmitChanges(); return task; } }
public static void roleMenuAuthorize(int roleid,int menuid,bool auth) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { if (auth) { t_Menu_Role mr = new t_Menu_Role(); mr.MenuKey = menuid; mr.RoleKey = roleid; dc.t_Menu_Role.InsertOnSubmit(mr); dc.SubmitChanges(); }else { t_Menu_Role mr = dc.t_Menu_Role.Where(m => m.RoleKey == roleid && m.MenuKey == menuid).Single(); dc.t_Menu_Role.DeleteOnSubmit(mr); dc.SubmitChanges(); } } }
public static bool updateWeekPlanReleaseState(int id ,bool state) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_Work_Plan plan = dc.t_Work_Plan.Where(i => i.Id == id).Single(); plan.isRelease = state; dc.SubmitChanges(); return true; } }
public static bool deleteRoutById(String id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_GZL_Rout rout = dc.t_GZL_Rout.Where(d => d.routId == Convert.ToInt32(id)).Single(); dc.t_GZL_Rout.DeleteOnSubmit(rout); dc.SubmitChanges(); return true; } }
public static bool deleteDepartmentById(String id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { Department dep = dc.Department.Where(d => d.ID == Convert.ToInt32(id)).Single(); dc.Department.DeleteOnSubmit(dep); dc.SubmitChanges(); return true; } }
public static bool deleteDepartmentLeaderById(String id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { Department_leader dl = dc.Department_leader.Where(u => u.ID == Convert.ToInt32(id)).Single(); dc.Department_leader.DeleteOnSubmit(dl); dc.SubmitChanges(); return true; } }
public static bool deleteAttendanceRecord(int id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { KQ_Attendance att = dc.KQ_Attendance.Where(i => i.Id == id).Single(); dc.KQ_Attendance.DeleteOnSubmit(att); dc.SubmitChanges(); return true; } }
public static bool deleteWorkPlanById(int id) { using (DataClassesEduDataContext dc = new DataClassesEduDataContext()) { t_Work_Plan plan = dc.t_Work_Plan.Where(w => w.Id == id).Single(); dc.t_Work_Plan.DeleteOnSubmit(plan); dc.SubmitChanges(); return true; } }