protected void Page_Load(object sender, EventArgs e) { // 관리자 체크 EmployeeInfo loginEmployee = new EmployeeInfo(); loginEmployee = (EmployeeInfo)Session["loginMember"]; if (loginEmployee == null) { Response.Redirect("~/login.aspx", true); } if (loginEmployee.ManagerLevel < 2) { Response.Redirect("~/login.aspx", true); } TakeOutPathStart bll = new TakeOutPathStart(); TakeOutPathStartInfo takeOutPathStartInfo = new TakeOutPathStartInfo(); takeOutPathStartInfo.TakeOutPathStartCode = Convert.ToInt32(Request.QueryString["takeOutPathStartCode"]); int result = bll.deleteTakeOutPathStart(takeOutPathStartInfo); Response.Redirect("takeOutPathStartList.aspx", true); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TakeOutPathStartInfo obj = (TakeOutPathStartInfo)e.Row.DataItem; HyperLink colModify = (HyperLink)e.Row.Cells[3].Controls[0]; colModify.NavigateUrl = "takeOutPathStartEdit.aspx?takeOutPathStartCode=" + obj.TakeOutPathStartCode + "&mode=modify"; colModify.ImageUrl = "~/images/icon/edit.gif"; HyperLink colDelete = (HyperLink)e.Row.Cells[4].Controls[0]; colDelete.NavigateUrl = "#"; colDelete.Attributes.Add("onclick", "return confirmDelete('takeOutPathStartDelete.aspx?takeOutPathStartCode=" + obj.TakeOutPathStartCode + "');"); colDelete.ImageUrl = "~/images/icon/delete.gif"; for (int i = 0; i < e.Row.Cells.Count; i++) { if (i < 3) { e.Row.Cells[i].Attributes.Add("onclick", "window.location='takeOutPathStartView.aspx?takeOutPathStartCode=" + obj.TakeOutPathStartCode + "';"); e.Row.Cells[i].Attributes.Add("style", "cursor:hand"); } } } }
/// <summary> /// /// </summary> /// <param name="rdr"></param> /// <param name="obj"></param> /// <returns></returns> private TakeOutPathStartInfo bindObject(SqlDataReader rdr, TakeOutPathStartInfo obj) { obj.TakeOutPathStartCode = rdr.GetInt32(0); obj.TakeOutPathStartName = rdr.GetString(1); obj.RegDate = rdr.GetDateTime(2); obj.Status = rdr.GetString(3); return(obj); }
protected void Page_Load(object sender, EventArgs e) { // 관리자 체크 EmployeeInfo loginEmployee = new EmployeeInfo(); loginEmployee = (EmployeeInfo)Session["loginMember"]; if (loginEmployee == null) { Response.Redirect("~/login.aspx", true); } if (loginEmployee.ManagerLevel < 2) { Response.Redirect("~/login.aspx", true); } if (Page.IsPostBack) { TakeOutPathStartInfo takeOutPathStartInfo = new TakeOutPathStartInfo(); takeOutPathStartInfo.TakeOutPathStartCode = Convert.ToInt32(Request.QueryString["takeOutPathStartCode"]); takeOutPathStartInfo.TakeOutPathStartName = txtCodeName.Text; takeOutPathStartInfo.Status = txtStatus.Text; // 수정하기 if (mode.Value.Equals("modify")) { int result = bll.updateTakeOutPathStart(takeOutPathStartInfo); Response.Redirect("takeOutPathStartList.aspx"); } // 등록하기 else { int result = bll.insertTakeOutPathStart(takeOutPathStartInfo); Response.Redirect("takeOutPathStartList.aspx");; } } else { if (Request.QueryString["mode"].Equals("modify")) { TakeOutPathStartInfo takeOutPathStartInfo = new TakeOutPathStartInfo(); takeOutPathStartInfo = bll.selectTakeOutPathStart(Request.QueryString["takeOutPathStartCode"]); txtCodeName.Text = takeOutPathStartInfo.TakeOutPathStartName; txtStatus.Text = takeOutPathStartInfo.Status; lableCodeName.Text = " Sửa thông tin (정보 수정하기) : " + takeOutPathStartInfo.TakeOutPathStartName; mode.Value = Request.QueryString["mode"]; } else { lableCodeName.Text = "Đăng ký (등록하기)"; mode.Value = Request.QueryString["mode"]; } } }
/// <summary> /// /// </summary> /// <param name="takeOutPathStartInfo"></param> /// <returns></returns> public int deleteTakeOutPathStart(TakeOutPathStartInfo takeOutPathStartInfo) { log.Debug("=================START deleteTakeOutPathStart================="); log.Debug("takeOutPathStartInfo = " + takeOutPathStartInfo.ToString()); StringBuilder sql_delete = new StringBuilder(); sql_delete.Append("DELETE FROM TakeOutPathStart WHERE takeOutPathStartCode=" + takeOutPathStartInfo.TakeOutPathStartCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_delete.ToString(), null); log.Debug(@"=================END deleteTakeOutPathStart================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutPathStartInfo"></param> /// <returns></returns> public int updateTakeOutPathStart(TakeOutPathStartInfo takeOutPathStartInfo) { log.Debug("=================START updateTakeOutPathStart================="); log.Debug("takeOutPathStartInfo = " + takeOutPathStartInfo.ToString()); StringBuilder sql_update = new StringBuilder(); sql_update.Append("UPDATE TakeOutPathStart SET takeOutPathStartName=N'" + takeOutPathStartInfo.TakeOutPathStartName + "', status=N'" + takeOutPathStartInfo.Status + "' WHERE takeOutPathStartCode=" + takeOutPathStartInfo.TakeOutPathStartCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_update.ToString(), null); log.Debug(@"=================END updateTakeOutPathStart================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutPathStartInfo"></param> /// <returns></returns> public int insertTakeOutPathStart(TakeOutPathStartInfo takeOutPathStartInfo) { log.Debug("=================START insertTakeOutPathStart================="); log.Debug("takeOutPathStartInfo = " + takeOutPathStartInfo.ToString()); StringBuilder sql_insert = new StringBuilder(); sql_insert.Append("INSERT INTO TakeOutPathStart"); sql_insert.Append(" (takeOutPathStartName,regDate,status) "); sql_insert.Append(" VALUES "); sql_insert.Append(" (N'" + takeOutPathStartInfo.TakeOutPathStartName + "',GETDATE(),N'" + takeOutPathStartInfo.Status + "') "); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_insert.ToString(), null); log.Debug(@"=================END insertTakeOutPathStart================="); return(result); }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <returns></returns> public List <TakeOutPathStartInfo> selectTakeOutPathStartList(string key) { log.Debug("=================START selectTakeOutPathStartList================="); log.Debug("key = " + key); List <TakeOutPathStartInfo> list = new List <TakeOutPathStartInfo>(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM TakeOutPathStart "); if (!String.IsNullOrEmpty(key)) { if (key.Equals("A")) { sql_select.Append(" WHERE status = 'Y' " + "\n"); } else { sql_select.Append("WHERE takeOutPathStartName LIKE '%" + key + "%'"); } } sql_select.Append("ORDER BY takeOutPathStartCode"); //Execute the query against the database using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_select.ToString(), null)) { // Scroll through the results while (rdr.Read()) { TakeOutPathStartInfo obj = new TakeOutPathStartInfo(); obj = bindObject(rdr, obj); list.Add(obj); } } log.Debug(@"=================END selectTakeOutPathStartList================="); return(list); }
/// <summary> /// /// </summary> /// <param name="takeOutPathStartCode"></param> /// <returns></returns> public TakeOutPathStartInfo selectTakeOutPathStart(string takeOutPathStartCode) { log.Debug("=================START selectTakeOutPathStart================="); log.Debug("takeOutPathStartCode = " + takeOutPathStartCode); TakeOutPathStartInfo obj = new TakeOutPathStartInfo(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM TakeOutPathStart WHERE takeOutPathStartCode=" + takeOutPathStartCode); using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_select.ToString(), null)) { if (rdr.Read()) { obj = bindObject(rdr, obj); } } log.Debug(@"=================END selectTakeOutPathStart================="); return(obj); }
/// <summary> /// 반출 시작 지점 삭제 /// </summary> /// <param name="takeOutPathStartInfo"></param> /// <returns></returns> public int deleteTakeOutPathStart(TakeOutPathStartInfo takeOutPathStartInfo) { return(dal.deleteTakeOutPathStart(takeOutPathStartInfo)); }
/// <summary> /// 반출 시작 지점 저장 /// </summary> /// <param name="takeOutPathStartInfo"></param> /// <returns></returns> public int insertTakeOutPathStart(TakeOutPathStartInfo takeOutPathStartInfo) { return(dal.insertTakeOutPathStart(takeOutPathStartInfo)); }
/// <summary> /// 반출 시작 지점 수정 /// </summary> /// <param name="takeOutPathStartInfo"></param> /// <returns></returns> public int updateTakeOutPathStart(TakeOutPathStartInfo takeOutPathStartInfo) { return(dal.updateTakeOutPathStart(takeOutPathStartInfo)); }