public ActionResult EditAssign(decimal id = 0) { var project_ins = db.TPR_PROJECT_INSTITUTE.Single(t => t.PROJECT_INS_NO == id); TPR_PROJECT project = db.TPR_PROJECT.Include("SET_CLASS").Single(p => p.PROJECT_NO == project_ins.PROJECT_NO); USER_INFO_VIEWMODEL zonal_info = (from u in db.SEC_USERS join d in db.SET_DESIGNATION on u.DESIG_NO equals d.DESIG_NO join t in db.SET_THANA on u.THANA_NO equals t.THANA_NO join z in db.SET_ZILLA on t.ZILLA_NO equals z.ZILLA_NO join div in db.SET_DIVISION on z.DIVISION_NO equals div.DIVISION_NO where u.USER_NO == project_ins.USER_NO select new USER_INFO_VIEWMODEL { userno = u.USER_NO, fullname = u.USER_FULL_NAME, username = u.USER_NAME, hrid = u.HR_EMP_ID, mobile = u.USER_MOBILE, designation = d.DESIG_NAME, thana = t.THANA_NAME, zilla = z.ZILLA_NAME, division = div.DIVISION_NAME }).FirstOrDefault(); INSTITUTE_INFO_VIEWMODEL institute_info = (from i in db.SET_INSTITUTE join t in db.SET_THANA on i.THANA_NO equals t.THANA_NO join z in db.SET_ZILLA on t.ZILLA_NO equals z.ZILLA_NO join d in db.SET_DIVISION on z.DIVISION_NO equals d.DIVISION_NO where i.INSTITUTE_NO == project_ins.INSTITUTE_NO select new INSTITUTE_INFO_VIEWMODEL { insname = i.INSTITUTE_NAME, inscode = i.INSTITUTE_NO, thana = t.THANA_NAME, zilla = z.ZILLA_NAME, division = d.DIVISION_NAME }).FirstOrDefault(); ViewBag.Subjects = db.SET_CLASS_SUBJECT_ASSIGN_GET(id, project.CLASS_NO).ToList(); ViewBag.PROJECT = Session["TPR_PROJECT"] = project; ViewBag.ZONAL_INFO = Session["TPR_ZONAL_INFO"] = zonal_info; ViewBag.INSTITUTE_INFO = Session["TPR_INS_INFO"] = institute_info; ViewBag.PROJECT_INSTITITE = Session["TPR_PROJECT_INS"] = project_ins; return(View()); }
public ActionResult GetSubjects(decimal?p_ins, string type) { ViewBag.Download_Allowed = false; ViewBag.Reset_Allowed = false; SEC_USERS_LOGIN_Result1 user = Session["sess_sec_users"] as SEC_USERS_LOGIN_Result1; if (user.USER_TYPE_NO == (decimal)EUserTypes.GeneralUser) { List <SET_USER_ACTION> perm_list = Session["sess_PERMISSION_LIST"] as List <SET_USER_ACTION>; foreach (var perm in perm_list) { GEN_CONTROLLER_ACTION controller_action = perm.GEN_CONTROLLER_ACTION; if (controller_action.CONTROLLER_NAME == "QuestionMonitor" && controller_action.ACTION_NAME == "Download") { ViewBag.Download_Allowed = true; } if (controller_action.CONTROLLER_NAME == "QuestionMonitor" && controller_action.ACTION_NAME == "Reset") { ViewBag.Reset_Allowed = true; } } } else { List <SET_ROLE_ACTION> perm_list = Session["sess_PERMISSION_LIST"] as List <SET_ROLE_ACTION>; foreach (var perm in perm_list) { GEN_CONTROLLER_ACTION controller_action = perm.GEN_CONTROLLER_ACTION; if (controller_action.CONTROLLER_NAME == "QuestionMonitor" && controller_action.ACTION_NAME == "Download") { ViewBag.Download_Allowed = true; } if (controller_action.CONTROLLER_NAME == "QuestionMonitor" && controller_action.ACTION_NAME == "Reset") { ViewBag.Reset_Allowed = true; } } } TPR_PROJECT_INSTITUTE pins = db.TPR_PROJECT_INSTITUTE .Single(t => t.PROJECT_INS_NO == p_ins); TPR_PROJECT project = db.TPR_PROJECT.Include("SET_CLASS") .Single(p => p.PROJECT_NO == pins.PROJECT_NO); USER_INFO_VIEWMODEL zonal_info = (from u in db.SEC_USERS join d in db.SET_DESIGNATION on u.DESIG_NO equals d.DESIG_NO join t in db.SET_THANA on u.THANA_NO equals t.THANA_NO join z in db.SET_ZILLA on t.ZILLA_NO equals z.ZILLA_NO join div in db.SET_DIVISION on z.DIVISION_NO equals div.DIVISION_NO where u.USER_NO == pins.USER_NO select new USER_INFO_VIEWMODEL { userno = u.USER_NO, fullname = u.USER_FULL_NAME, username = u.USER_NAME, hrid = u.HR_EMP_ID, mobile = u.USER_MOBILE, designation = d.DESIG_NAME, thana = t.THANA_NAME, zilla = z.ZILLA_NAME, division = div.DIVISION_NAME }).FirstOrDefault(); INSTITUTE_INFO_VIEWMODEL institute_info = (from i in db.SET_INSTITUTE join t in db.SET_THANA on i.THANA_NO equals t.THANA_NO join z in db.SET_ZILLA on t.ZILLA_NO equals z.ZILLA_NO join d in db.SET_DIVISION on z.DIVISION_NO equals d.DIVISION_NO where i.INSTITUTE_NO == pins.INSTITUTE_NO select new INSTITUTE_INFO_VIEWMODEL { insname = i.INSTITUTE_NAME, inscode = i.INSTITUTE_NO, thana = t.THANA_NAME, zilla = z.ZILLA_NAME, division = d.DIVISION_NAME }).FirstOrDefault(); ViewBag.PROJECT = project; ViewBag.ZONAL_INFO = zonal_info; ViewBag.INSTITUTE_INFO = institute_info; ViewBag.PROJECT_INSTITUTE = pins; decimal?USER_NO = Session["sess_USER_NO"] as decimal?; decimal?LOGON_NO = Session["sess_LOGON_NO"] as decimal?; var subjects = db.TPR_SUBJECTS_GET(p_ins, type, 0, null, USER_NO, LOGON_NO).ToList(); return(PartialView("_GetSubjects", subjects)); }