Exemple #1
0
        public string ChkUpdtEseGrade(EseGradeViewModels model)
        {
            //esecode
            HttpContext context  = HttpContext.Current;
            string      ESE_CODE = context.Session["ESE_CODE"].ToString();

            string errorStr = "";
            string result   = "";

            string listQuery = " SELECT count(*) as cnt FROM ese_group WHERE group_name = '" + model.Item.GROUP_NAME + "'  AND ESE_CODE = '" + ESE_CODE + "' ";


            int reCnt = getQueryCnt(listQuery, out errorStr);

            if (model.act_type != null && model.schTxt2 == "ins")
            {
                if (reCnt > 0 && model.Item.GROUP_NAME != null)
                {
                    result = @comm_global.Language.Resources.ESE_RETURN_DuplicatedInfo + "[" + @comm_global.Language.Resources.ESE_EseGrade_GroupName + "]";
                }
            }
            else if (model.act_type != null && model.schTxt2 == "updt")
            {
                if (reCnt > 1 && model.Item.GROUP_NAME != null)
                {
                    result = @comm_global.Language.Resources.ESE_RETURN_DuplicatedInfo + "[" + @comm_global.Language.Resources.ESE_EseGrade_GroupName + "]";
                }
            }


            return(result);
        }
Exemple #2
0
        public ActionResult EseIframeGradeView(EseGradeViewModels model, string GROUP_ID)
        {
            if (model.act_type == "ins")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EseInfo", "PER_INSERT"))
                {
                    return(RedirectToAction("EseIframeGradeView", new { msg = chk.alertStr }));
                }
                //===========================================================
            }

            if (model.act_type == "updt")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EseInfo", "PER_UPDATE"))
                {
                    return(RedirectToAction("EseIframeGradeView", 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.SetEseGrade(model, GROUP_ID);

            return(RedirectToAction("EseIframeGradeView", new { seqNo = model.act_key, Msg = PublicPopupMsg }));
        }
Exemple #3
0
        public ActionResult EseGradeView(string seqNo, string Msg)
        {
            //권한 체크===================================================
            if (!chk.chkPermission("EseGrade", "PER_SELECT"))
            {
                return(RedirectToAction("Index", "Home", new { msg = chk.alertStr }));
            }
            //===========================================================



            EseGradeViewModels model = new EseGradeViewModels();
            int pSeqNo = 0;

            if (int.TryParse(seqNo, out pSeqNo))
            {
                model.act_type = "updt";
                model.act_key  = pSeqNo;
            }
            else
            {
                model.act_type      = "ins";
                model.Item.ESE_CODE = (string)Session["ESE_CODE"];
                model.Item.GROUP_ID = 0;
            }

            if (!String.IsNullOrEmpty(Msg))
            {
                ViewBag.PublicPopupMsg = Msg;
            }

            model = act.GetEseGradeView(model);


            //메뉴명 가져오기
            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));
        }
Exemple #4
0
        public ActionResult EseGradeView(EseGradeViewModels model)
        {
            if (model.act_type == "ins")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EseGrade", "PER_INSERT"))
                {
                    return(RedirectToAction("EseGradeView", new { msg = chk.alertStr }));
                }
                //===========================================================
            }

            if (model.act_type == "updt")
            {
                //권한 체크===================================================
                if (!chk.chkPermission("EseGrade", "PER_UPDATE"))
                {
                    return(RedirectToAction("EseGradeView", new { msg = chk.alertStr }));
                }
                //===========================================================
            }

            // 중복체크를 사용을 위해 act_key, act_type
            // 중복체크를 사용을 위해 act_key, schTxt2
            model.act_key = 1;
            model.schTxt2 = "updt";
            if (model.Item.GROUP_NAME == "")
            {
                model.act_key = 0;
                model.schTxt2 = "ins";
            }

            string chkDupl = act.ChkUpdtEseGrade(model);

            if (chkDupl != "")
            {
                return(RedirectToAction("EseGradeView", new { msg = chkDupl }));
            }

            //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;
                }
            }

            //그룹명 유효성 검사
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            string PublicPopupMsg = act.SetEseGrade(model);

            return(RedirectToAction("EseGradeView", new { seqNo = model.act_key, Msg = PublicPopupMsg }));
        }
Exemple #5
0
        public string SetEseGrade(EseGradeViewModels model)
        {
            //세션에 저장된 ESE코드 가져오기
            HttpContext context = HttpContext.Current;

            model.Item.ESE_CODE = context.Session["ESE_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 ese_group ( GROUP_ID , GROUP_NAME, ESE_CODE )VALUES(  ";
                exeQueryStr += " " + model.Item.GROUP_ID + "";
                exeQueryStr += ", '" + model.Item.GROUP_NAME + "' ";
                exeQueryStr += ", '" + model.Item.ESE_CODE + "' ";
                exeQueryStr += " ) ";

                queryList.Add(exeQueryStr);

                //ese_group_permission 권한
                foreach (EseGroupPermission temp in model.Items)
                {
                    exeQueryStr  = " INSERT INTO ese_group_permission ( GROUP_ID , ESE_CODE, MENU_ID, PER_SELECT, PER_INSERT, PER_UPDATE, PER_DELETE )VALUES(  ";
                    exeQueryStr += " ( SELECT MAX(GROUP_ID) FROM ese_group ) ";                    // + model.Item.GROUP_ID;
                    exeQueryStr += " , '" + model.Item.ESE_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 ese_group SET ";
                exeQueryStr += "GROUP_NAME = '" + model.Item.GROUP_NAME + "'";
                exeQueryStr += " WHERE GROUP_ID = " + model.Item.GROUP_ID;

                queryList.Add(exeQueryStr);

                queryList.Add(" DELETE FROM ese_group_permission WHERE GROUP_ID = '" + model.Item.GROUP_ID + "' ");

                //ese_group_permission 권한
                foreach (EseGroupPermission temp in model.Items)
                {
                    exeQueryStr  = " INSERT INTO ese_group_permission ( GROUP_ID , ESE_CODE, MENU_ID, PER_SELECT, PER_INSERT, PER_UPDATE, PER_DELETE )VALUES(  ";
                    exeQueryStr += " , '" + model.Item.GROUP_ID + "'";
                    exeQueryStr += " , '" + model.Item.ESE_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
            {
                result = "잘못된 접근입니다.";
                return(result);
            }

            if (exeQuery(queryList, out errorStr))
            {
                result = "성공.";
            }
            else
            {
                result = "실패.";
            }

            return(result);
        }
Exemple #6
0
        public EseGradeViewModels GetEseGradeView(EseGradeViewModels model)
        {
            string errorStr = "";

            //그룹 가져오기
            string listQuery = " SELECT GROUP_ID , GROUP_NAME FROM ese_group WHERE GROUP_ID = " + model.act_key;

            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 , MENU_ID, PER_SELECT, PER_INSERT, PER_UPDATE, PER_DELETE FROM ese_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++)
                {
                    EseGroupPermission temp = new EseGroupPermission();
                    temp.GROUP_ID       = int.Parse(listDt.Rows[i]["GROUP_ID"].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)
                {
                    EseGroupPermission temp = new EseGroupPermission();

                    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);
        }