protected void iBtnSave_Click(object sender, ImageClickEventArgs e) { DeptInfos dept = new DeptInfos(); string mode = WebUtility.GetRequest("mode"); if (ltrHiddenDeptID.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("부서를 선택해 주세요.", false); return; } if (mode.Equals("New")) { if (txtDeptNew.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("등록하실 부서명을 입력하세요.", false); return; } dept.AddDeptinfo(int.Parse(ltrHiddenDeptID.Text), int.Parse(ltrHiddenLevel.Text) + 1, txtDeptNew.Text, int.Parse(Request["estterm_ref_id"])); //Response.Write(dept.IERRMSG.Replace("'", "")); WebCommon.FillEstTree(TreeView1, WebUtility.GetRequestByInt("estterm_ref_id")); TreeView1.ExpandAll(); Literal1.Text = JSHelper.GetOpenerControlCallBackScript(this.ICCB1, true); } else if (mode.Equals("Rename")) { if (txtDeptRename.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("바꾸실 부서명을 입력하세요.", false); return; } /* 2011-06-13 수정 : 명칭변경시에 sortOrder도 수정하도록 변경 */ //dept.RenameDeptName(int.Parse(Request["estterm_ref_id"]), int.Parse(ltrHiddenDeptID.Text), txtDeptRename.Text); int sortOrder = Convert.ToInt32(txtSortOrder.Text); dept.RenameDeptName(WebUtility.GetRequestByInt("estterm_ref_id"), int.Parse(ltrHiddenDeptID.Text), txtDeptRename.Text, sortOrder); /* 2011-06-13 수정 완료 ****************************************/ WebCommon.FillEstTree(TreeView1, int.Parse(Request["estterm_ref_id"])); TreeView1.ExpandAll(); Literal1.Text = JSHelper.GetOpenerControlCallBackScript(this.ICCB1, true); } else if (mode.Equals("Move")) { if (txtMoveDeptID.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("이동하실 부서경로를 선택 하세요.", false); return; } dept.MoveDeptPath(WebUtility.GetRequestByInt("estterm_ref_id"), int.Parse(ltrHiddenDeptID.Text), int.Parse(txtMoveDeptID.Text), int.Parse(txtMoveLevel.Text) + 1); //WebCommon.FillEstTree(TreeView1, int.Parse(Request["estterm_ref_id"])); Literal1.Text = JSHelper.GetOpenerControlCallBackScript(this.ICCB1, true); } else if (mode.Equals("Remove")) { if (ltrTreePath_Remove.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("삭제하실 부서를 선택 하세요.", false); return; } bool isOK = dept.RemoveDeptInfo(WebUtility.GetRequestByInt("estterm_ref_id"), int.Parse(ltrHiddenDeptID.Text)); WebCommon.FillEstTree(TreeView1, WebUtility.GetRequestByInt("estterm_ref_id")); TreeView1.ExpandAll(); Literal1.Text = JSHelper.GetOpenerControlCallBackScript(this.ICCB1, true); //if (!isOK) //{ // Literal1.Text = JSHelper.GetAlertScript("사용 중인 평가 부서입니다.", false); //} //else //{ // Literal1.Text = JSHelper.GetAlertOpenerControlCallBackScript("정상적으로 부서명이 삭제되었습니다.", "lBtnReload", true); //} } }
protected void iBtnSave_Click(object sender, ImageClickEventArgs e) { DeptInfos dept = new DeptInfos(); if (ltrHiddenDeptID.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("부서를 선택해 주세요.", false); return; } if (Request["mode"].Equals("New")) { if (txtDeptNew.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("등록하실 부서명을 입력하세요.", false); return; } dept.AddDeptInfo(int.Parse(ltrHiddenDeptID.Text) , int.Parse(ltrHiddenLevel.Text) + 1 , txtDeptNew.Text , DateTime.Now , ((SiteIdentity)User.Identity).Emp_Ref_ID); Response.Redirect("ctl2103.aspx?mode=New"); } else if (Request["mode"].Equals("Rename")) { if (txtDeptRename.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("바꾸실 부서명을 입력하세요.", false); return; } dept.RenameDeptName(int.Parse(ltrHiddenDeptID.Text), txtDeptRename.Text); Response.Redirect("ctl2103.aspx?mode=Rename"); } else if (Request["mode"].Equals("Move")) { if (txtMoveDeptID.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("이동하실 부서경로를 선택 하세요.", false); return; } dept.MoveDeptPath(int.Parse(ltrHiddenDeptID.Text), int.Parse(txtMoveDeptID.Text), int.Parse(txtMoveLevel.Text) + 1); Response.Redirect("ctl2103.aspx?mode=Move"); } else if (Request["mode"].Equals("Remove")) { if (ltrTreePath_Remove.Text.Equals("")) { Literal1.Text = JSHelper.GetAlertScript("삭제하실 부서를 선택 하세요.", false); return; } bool isOK = dept.RemoveDeptinfo(int.Parse(ltrHiddenDeptID.Text)); if (!isOK) { Literal1.Text = JSHelper.GetAlertScript("소속되어 있는 부서나 사원이 있습니다. 확인 후 삭제 해주세요.", false); } else { Response.Redirect("ctl2103.aspx?mode=Remove"); } } }