public ActionResult EstIframeGradeView(EstGradeViewModel model) { if (model.act_type == "ins") { //권한 체크=================================================== if (!chk.chkPermission("EseInfo", "PER_INSERT")) { return(RedirectToAction("EstIframeGradeView", new { msg = chk.alertStr })); } //=========================================================== } if (model.act_type == "updt") { //권한 체크=================================================== if (!chk.chkPermission("EseInfo", "PER_UPDATE")) { return(RedirectToAction("EstIframeGradeView", new { msg = chk.alertStr })); } //=========================================================== } //ese_group_permission 권한 for (int i = 0; i < model.Items.Count; i++) { model.Items[i].PER_SELECT = 0; model.Items[i].PER_INSERT = 0; model.Items[i].PER_UPDATE = 0; model.Items[i].PER_DELETE = 0; if (model.Items[i].CHK_PER_SELECT) { model.Items[i].PER_SELECT = 1; } if (model.Items[i].CHK_PER_INSERT) { model.Items[i].PER_INSERT = 1; } if (model.Items[i].CHK_PER_UPDATE) { model.Items[i].PER_UPDATE = 1; } if (model.Items[i].CHK_PER_DELETE) { model.Items[i].PER_DELETE = 1; } } string PublicPopupMsg = act.SetEstGrade(model); //return RedirectToAction("EseGradeView", new { Msg = PublicPopupMsg }); 아래껄로 교체 return(RedirectToAction("EstIframeGradeView", new { seqNo = model.act_key, Msg = PublicPopupMsg })); }
public ActionResult EstIframeGradeView(string Msg, string groupId, string estCode) { //권한 체크=================================================== if (!chk.chkPermission("EstInfo", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== EstGradeViewModel model = new EstGradeViewModel(); model = act.GetEstGradeView(groupId, estCode); model.viewEstCode = estCode; model.Item.EST_CODE = model.viewEstCode; int pSeqNo = 0; if (int.TryParse(groupId, out pSeqNo)) { model.act_type = "updt"; } else { model.act_type = "ins"; } if (!String.IsNullOrEmpty(Msg)) { ViewBag.PublicPopupMsg = Msg; } //메뉴명 가져오기 List <schTypeArray> tempGrade = comF.GetGradeList(); for (int i = 0; i < model.Items.Count; i++) { foreach (schTypeArray tempS in tempGrade) { if (tempS.opt_key == model.Items[i].MENU_ID) { model.Items[i].MENU_NAME = tempS.opt_value; } } } return(View(model)); }
public string SetEstGrade(EstGradeViewModel model) { //세션에 저장된 ESE코드 가져오기 //HttpContext context = HttpContext.Current; //model.Item.EST_CODE = context.Session["EST_CODE"].ToString(); string errorStr = ""; string result = ""; string exeQueryStr = ""; List <string> queryList = new List <string>(); if (model.act_type != null && model.act_type == "ins") { //ese_group 그룹 exeQueryStr = " INSERT INTO est_group ( GROUP_ID , GROUP_NAME, EST_CODE )VALUES( "; exeQueryStr += " " + model.Item.GROUP_ID + ""; exeQueryStr += ", '" + model.Item.GROUP_NAME + "' "; exeQueryStr += ", '" + model.Item.EST_CODE + "' "; exeQueryStr += " ) "; queryList.Add(exeQueryStr); //est_group_permission 권한 foreach (EstGroupPermisson temp in model.Items) { exeQueryStr = " INSERT INTO est_group_permission ( GROUP_ID , EST_CODE, MENU_ID, PER_SELECT, PER_INSERT, PER_UPDATE, PER_DELETE )VALUES( "; exeQueryStr += " ( SELECT MAX(GROUP_ID) FROM est_group ) "; // + model.Item.GROUP_ID; exeQueryStr += " , '" + model.Item.EST_CODE + "'"; exeQueryStr += " , '" + temp.MENU_ID + "'"; exeQueryStr += " , " + temp.PER_SELECT; exeQueryStr += " , " + temp.PER_INSERT; exeQueryStr += " , " + temp.PER_UPDATE; exeQueryStr += " , " + temp.PER_DELETE; exeQueryStr += " ) "; queryList.Add(exeQueryStr); } } else if (model.act_type != null && model.act_type == "updt") { //ese_group 그룹 exeQueryStr = " UPDATE est_group SET "; exeQueryStr += "GROUP_NAME = '" + model.Item.GROUP_NAME + "'"; exeQueryStr += " WHERE GROUP_ID = " + model.Item.GROUP_ID; queryList.Add(exeQueryStr); //ese_group_permission 권한 foreach (EstGroupPermisson temp in model.Items) { exeQueryStr = " UPDATE est_group_permission SET "; exeQueryStr += " PER_SELECT = " + temp.PER_SELECT; exeQueryStr += " , PER_INSERT = " + temp.PER_INSERT; exeQueryStr += " , PER_UPDATE = " + temp.PER_UPDATE; exeQueryStr += " , PER_DELETE = " + temp.PER_DELETE; exeQueryStr += " WHERE GROUP_ID = " + model.Item.GROUP_ID + " AND MENU_ID = '" + temp.MENU_ID + "'"; queryList.Add(exeQueryStr); } } else { result = "잘못된 접근입니다."; return(result); } if (exeQuery(queryList, out errorStr)) { result = "성공."; } else { result = "실패."; } return(result); }
public EstGradeViewModel GetEstGradeView(EstGradeViewModel model) { string errorStr = ""; //그룹 가져오기 string listQuery = " SELECT GROUP_ID , GROUP_NAME FROM est_group WHERE EST_CODE"; DataTable listDt = getQueryResult(listQuery, out errorStr); if (listDt != null && listDt.Rows.Count != 0) { model.Item.GROUP_ID = int.Parse(listDt.Rows[0]["GROUP_ID"].ToString().Trim()); model.Item.GROUP_NAME = listDt.Rows[0]["GROUP_NAME"].ToString().Trim(); } //권한 가져오기 listQuery = " SELECT GROUP_ID , EST_CODE, MENU_ID, PER_SELECT, PER_INSERT, PER_UPDATE, PER_DELETE FROM est_group_permission WHERE GROUP_ID = " + model.Item.GROUP_ID; listDt = getQueryResult(listQuery, out errorStr); if (listDt != null && listDt.Rows.Count != 0) { for (int i = 0; i < listDt.Rows.Count; i++) { EstGroupPermisson temp = new EstGroupPermisson(); temp.GROUP_ID = int.Parse(listDt.Rows[i]["GROUP_ID"].ToString().Trim()); temp.EST_CODE = listDt.Rows[i]["EST_CODE"].ToString().Trim(); temp.MENU_ID = listDt.Rows[i]["MENU_ID"].ToString().Trim(); temp.PER_SELECT = int.Parse(listDt.Rows[i]["PER_SELECT"].ToString().Trim()); temp.PER_INSERT = int.Parse(listDt.Rows[i]["PER_INSERT"].ToString().Trim()); temp.PER_UPDATE = int.Parse(listDt.Rows[i]["PER_UPDATE"].ToString().Trim()); temp.PER_DELETE = int.Parse(listDt.Rows[i]["PER_DELETE"].ToString().Trim()); temp.CHK_PER_SELECT = false; if (temp.PER_SELECT == 1) { temp.CHK_PER_SELECT = true; } temp.CHK_PER_INSERT = false; if (temp.PER_INSERT == 1) { temp.CHK_PER_INSERT = true; } temp.CHK_PER_UPDATE = false; if (temp.PER_UPDATE == 1) { temp.CHK_PER_UPDATE = true; } temp.CHK_PER_DELETE = false; if (temp.PER_DELETE == 1) { temp.CHK_PER_DELETE = true; } model.Items.Add(temp); } } else { //등록된 데이터가 없을 경우 CommFunction comF = new CommFunction(); List <schTypeArray> tempGrade = comF.GetGradeList(); foreach (schTypeArray tempItem in tempGrade) { EstGroupPermisson temp = new EstGroupPermisson(); temp.GROUP_ID = model.Item.GROUP_ID; temp.MENU_ID = tempItem.opt_key; temp.MENU_NAME = tempItem.opt_value; temp.PER_DELETE = 0; temp.PER_INSERT = 0; temp.PER_SELECT = 0; temp.PER_UPDATE = 0; temp.CHK_PER_SELECT = true; temp.CHK_PER_INSERT = true; temp.CHK_PER_UPDATE = true; temp.CHK_PER_DELETE = true; model.Items.Add(temp); } } return(model); }