public ActionResult EsmAccount(EsmAccountModels model) { //권한 체크=================================================== if (!chk.chkPermission("EsmAccount", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== //삭제일 경우 if (model.act_type == "del") { //권한 체크=================================================== if (!chk.chkPermission("EsmAccount", "PER_DELETE")) { return(RedirectToAction("EsmAccount", new { msg = chk.alertStr })); } //=========================================================== TempData["PublicMsg"] = act.DelEsmAccount(model.act_key); //삭제 model.act_type = "list"; model.act_key = 0; return(RedirectToAction("EsmAccount", model)); } model = act.GetEsmAccountList(model); if (TempData["PublicMsg"] != null) { ViewBag.PublicMsg = TempData["PublicMsg"].ToString(); } return(View(model)); }
public EsmUser GetEsmAccountView(EsmAccountModels getModel) { string errorStr = ""; EsmUser model = new EsmUser(); string listQuery = " SELECT SEQNO, EMAIL, PASSWD, USERNAME, TELNO, GROUP_ID, CREATETIME, DEPARTMENT, POSITION, MEMO, STATUS FROM esm_user WHERE SEQNO = " + getModel.act_key; DataTable listDt = getQueryResult(listQuery, out errorStr); if (listDt != null && listDt.Rows.Count != 0) { model.SEQNO = int.Parse(listDt.Rows[0]["SEQNO"].ToString().Trim()); model.EMAIL = listDt.Rows[0]["EMAIL"].ToString().Trim(); model.PASSWD = listDt.Rows[0]["PASSWD"].ToString().Trim(); model.USERNAME = listDt.Rows[0]["USERNAME"].ToString().Trim(); model.TELNO = listDt.Rows[0]["TELNO"].ToString().Trim(); model.GROUP_ID = int.Parse(listDt.Rows[0]["GROUP_ID"].ToString().Trim()); model.CREATETIME = listDt.Rows[0]["CREATETIME"].ToString().Trim(); model.DEPARTMENT = listDt.Rows[0]["DEPARTMENT"].ToString().Trim(); model.POSITION = listDt.Rows[0]["POSITION"].ToString().Trim(); model.MEMO = listDt.Rows[0]["MEMO"].ToString().Trim(); model.STATUS = int.Parse(listDt.Rows[0]["STATUS"].ToString().Trim()); } return(model); }
public EsmAccountModels GetEsmAccountList(EsmAccountModels model) { string errorStr = ""; string listQuery = " SELECT SEQNO, EMAIL,PASSWD,USERNAME,TELNO,eu.GROUP_ID,eg.GROUP_NAME,CREATETIME,DEPARTMENT,POSITION,MEMO,STATUS FROM esm_user eu left outer join esm_group eg on eu.GROUP_ID = eg.GROUP_ID ORDER BY SEQNO "; DataTable listDt = getQueryResult(listQuery, out errorStr); if (listDt != null && listDt.Rows.Count != 0) { for (int i = 0; i < listDt.Rows.Count; i++) { EsmUser temp = new EsmUser(); temp.SEQNO = int.Parse(listDt.Rows[i]["SEQNO"].ToString().Trim()); temp.EMAIL = listDt.Rows[i]["EMAIL"].ToString().Trim(); temp.PASSWD = listDt.Rows[i]["PASSWD"].ToString().Trim(); temp.USERNAME = listDt.Rows[i]["USERNAME"].ToString().Trim(); temp.TELNO = listDt.Rows[i]["TELNO"].ToString().Trim(); temp.GROUP_ID = int.Parse(listDt.Rows[i]["GROUP_ID"].ToString().Trim()); temp.GROUP_NAME = listDt.Rows[i]["GROUP_NAME"].ToString().Trim(); temp.CREATETIME = listDt.Rows[i]["CREATETIME"].ToString().Trim(); temp.DEPARTMENT = listDt.Rows[i]["DEPARTMENT"].ToString().Trim(); temp.POSITION = listDt.Rows[i]["POSITION"].ToString().Trim(); temp.MEMO = listDt.Rows[i]["MEMO"].ToString().Trim(); temp.STATUS = int.Parse(listDt.Rows[i]["STATUS"].ToString().Trim()); model.Items.Add(temp); } } return(model); }
public ActionResult EsmAccountView(EsmAccountModels model) { if (model.act_type == "ins") { //권한 체크=================================================== if (!chk.chkPermission("EsmAccount", "PER_INSERT")) { return(RedirectToAction("EsmAccountView", new { msg = chk.alertStr })); } //=========================================================== } if (model.act_type == "updt") { //권한 체크=================================================== if (!chk.chkPermission("EsmAccount", "PER_UPDATE")) { return(RedirectToAction("EsmAccountView", new { msg = chk.alertStr })); } //=========================================================== } if (!ModelState.IsValid) { return(View(model)); } //라디오버튼 쓰기 if (model.RadioBoxPop == true) { model.Item.STATUS = 1; } else { model.Item.STATUS = 0; } model.Item.GROUP_ID = model.GroupId; model.RadioBoxPop = false; if (model.Item.STATUS == 1) { model.RadioBoxPop = true; } //SELECT BOX ARRAY 데이터 설정 model.GroupIdArray = comF.GroupIdSelectBox(); //model.Item.GROUP_ID = int.Parse(Request.Form["GROUP_ID"]); //권한 관련과 같이 갈 것들 이걸 적용시키면 Radio 버튼이 안된다.추후 같이 갈 수 있는 방식을 찾아야 한다. //string PublicPopupMsg = act.SetEsmAccount(model); //return RedirectToAction("EsmAccountView", new { seqNo = model.act_key, Msg = PublicPopupMsg }); ViewBag.PublicPopupMsg = act.SetEsmAccount(model); return(View(model)); }
public string SetEsmAccount(EsmAccountModels model) { string errorStr = ""; string result = ""; string exeQueryStr = ""; if (model.act_type != null && model.act_type == "ins") { exeQueryStr = " INSERT INTO esm_user ( EMAIL, PASSWD, USERNAME, TELNO, GROUP_ID, DEPARTMENT, POSITION, MEMO, STATUS )VALUES( "; exeQueryStr += " '" + model.Item.EMAIL + "'"; exeQueryStr += " , '" + model.Item.PASSWD + "'"; exeQueryStr += " , '" + model.Item.USERNAME + "'"; exeQueryStr += " , '" + model.Item.TELNO + "'"; exeQueryStr += " , " + model.Item.GROUP_ID; exeQueryStr += " , '" + model.Item.DEPARTMENT + "'"; exeQueryStr += " , '" + model.Item.POSITION + "'"; exeQueryStr += " , '" + model.Item.MEMO + "'"; exeQueryStr += " , " + model.Item.STATUS; exeQueryStr += " ) "; } else if (model.act_type != null && model.act_type == "updt") { exeQueryStr = " UPDATE esm_user SET "; exeQueryStr += " EMAIL = '" + model.Item.EMAIL + "'"; //exeQueryStr += " ,PASSWD = '" + model.Item.PASSWD + "'"; exeQueryStr += " ,USERNAME = '******'"; exeQueryStr += " ,TELNO = '" + model.Item.TELNO + "'"; exeQueryStr += " ,GROUP_ID = " + model.Item.GROUP_ID; exeQueryStr += " ,DEPARTMENT = '" + model.Item.DEPARTMENT + "'"; exeQueryStr += " ,POSITION = '" + model.Item.POSITION + "'"; exeQueryStr += " ,MEMO = '" + model.Item.MEMO + "'"; exeQueryStr += " ,STATUS = " + model.Item.STATUS; exeQueryStr += " WHERE SEQNO = " + model.Item.SEQNO; } else { result = "잘못된 접근입니다."; return(result); } if (exeQuery(exeQueryStr, out errorStr)) { result = "성공."; } else { result = "실패."; } return(result); }
public ActionResult EsmAccountView(string seqNo, string Msg) { //권한 체크=================================================== if (!chk.chkPermission("EsmAccount", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== EsmAccountModels model = new EsmAccountModels(); int pSeqNo = 0; if (int.TryParse(seqNo, out pSeqNo)) { model.act_type = "updt"; model.act_key = pSeqNo; } else { model.act_type = "ins"; model.Item.GROUP_ID = 0; } if (!String.IsNullOrEmpty(Msg)) { ViewBag.PublicPopupMsg = Msg; } model.Item = act.GetEsmAccountView(model); model.RadioBoxPop = false; if (model.Item.STATUS == 1) { model.RadioBoxPop = true; } //SELECT BOX ARRAY 데이터 설정 comF에 그룹 id 추가해야한다. model.GroupIdArray = comF.GroupIdSelectBox(); return(View(model)); }
// GET:ESM 관리자 설정 ESM 계정 관리 public ActionResult EsmAccount(string msg) { //권한 체크=================================================== if (!chk.chkPermission("EsmAccount", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== TempData["PublicMsg"] = null; if (!string.IsNullOrEmpty(msg)) { TempData["PublicMsg"] = msg; } EsmAccountModels model = new EsmAccountModels(); model = act.GetEsmAccountList(model); return(View(model)); }