protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TakeOutPathEndInfo obj = (TakeOutPathEndInfo)e.Row.DataItem; HyperLink colModify = (HyperLink)e.Row.Cells[3].Controls[0]; colModify.NavigateUrl = "takeOutPathEndEdit.aspx?takeOutEndEndCode=" + obj.TakeOutPathEndCode + "&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('takeOutPathEndDelete.aspx?takeOutPathEndCode=" + obj.TakeOutPathEndCode + "');"); 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='takeOutPathEndView.aspx?takeOutPathEndCode=" + obj.TakeOutPathEndCode + "';"); e.Row.Cells[i].Attributes.Add("style", "cursor:hand"); } } } }
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); } TakeOutPathEnd bll = new TakeOutPathEnd(); TakeOutPathEndInfo takeOutPathEndInfo = new TakeOutPathEndInfo(); takeOutPathEndInfo.TakeOutPathEndCode = Convert.ToInt32(Request.QueryString["takeOutPathEndCode"]); int result = bll.deleteTakeOutPathEnd(takeOutPathEndInfo); Response.Redirect("takeOutPathEndList.aspx", true); }
/// <summary> /// /// </summary> /// <param name="rdr"></param> /// <param name="obj"></param> /// <returns></returns> private TakeOutPathEndInfo bindObject(SqlDataReader rdr, TakeOutPathEndInfo obj) { obj.TakeOutPathEndCode = rdr.GetInt32(0); obj.TakeOutPathEndName = 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) { TakeOutPathEndInfo takeOutPathEndInfo = new TakeOutPathEndInfo(); takeOutPathEndInfo.TakeOutPathEndCode = Convert.ToInt32(Request.QueryString["takeOutEndEndCode"]); takeOutPathEndInfo.TakeOutPathEndName = txtCodeName.Text; takeOutPathEndInfo.Status = txtStatus.Text; // 수정하기 Sửa if (mode.Value.Equals("modify")) { int result = bll.updateTakeOutPathEnd(takeOutPathEndInfo); Response.Redirect("takeOutPathEndList.aspx"); } // 등록하기 đăng ký else { int result = bll.insertTakeOutPathEnd(takeOutPathEndInfo); Response.Redirect("takeOutPathEndList.aspx");; } } else { if (Request.QueryString["mode"].Equals("modify")) { TakeOutPathEndInfo takeOutPathEndInfo = new TakeOutPathEndInfo(); takeOutPathEndInfo = bll.selectTakeOutPathEnd(Request.QueryString["takeOutEndEndCode"]); txtCodeName.Text = takeOutPathEndInfo.TakeOutPathEndName; txtStatus.Text = takeOutPathEndInfo.Status; lableCodeName.Text = " Sửa thông tin (정보 수정하기) : " + takeOutPathEndInfo.TakeOutPathEndName; mode.Value = Request.QueryString["mode"]; } else { lableCodeName.Text = "Đăng ký (등록하기)"; mode.Value = Request.QueryString["mode"]; } } }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndInfo"></param> /// <returns></returns> public int deleteTakeOutPathEnd(TakeOutPathEndInfo takeOutPathEndInfo) { log.Debug("=================START deleteTakeOutPathEnd================="); log.Debug("takeOutPathEndInfo = " + takeOutPathEndInfo.ToString()); StringBuilder sql_delete = new StringBuilder(); sql_delete.Append("DELETE FROM TakeOutPathEnd WHERE takeOutPathEndCode=" + takeOutPathEndInfo.TakeOutPathEndCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_delete.ToString(), null); log.Debug(@"=================END deleteTakeOutPathEnd================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndInfo"></param> /// <returns></returns> public int updateTakeOutPathEnd(TakeOutPathEndInfo takeOutPathEndInfo) { log.Debug("=================START updateTakeOutPathEnd================="); log.Debug("takeOutPathEndInfo = " + takeOutPathEndInfo.ToString()); StringBuilder sql_update = new StringBuilder(); sql_update.Append("UPDATE TakeOutPathEnd SET takeOutPathEndName=N'" + takeOutPathEndInfo.TakeOutPathEndName + "', status=N'" + takeOutPathEndInfo.Status + "' WHERE takeOutPathEndCode=" + takeOutPathEndInfo.TakeOutPathEndCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_update.ToString(), null); log.Debug(@"=================END updateTakeOutPathEnd================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndInfo"></param> /// <returns></returns> public int insertTakeOutPathEnd(TakeOutPathEndInfo takeOutPathEndInfo) { log.Debug("=================START insertTakeOutPathEnd================="); log.Debug("takeOutPathEndInfo = " + takeOutPathEndInfo.ToString()); StringBuilder sql_insert = new StringBuilder(); sql_insert.Append("INSERT INTO TakeOutPathEnd"); sql_insert.Append(" (takeOutPathEndName,regDate,status) "); sql_insert.Append(" VALUES "); sql_insert.Append(" (N'" + takeOutPathEndInfo.TakeOutPathEndName + "',GETDATE(),N'" + takeOutPathEndInfo.Status + "')"); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_insert.ToString(), null); log.Debug(@"=================END insertTakeOutPathEnd================="); return(result); }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <returns></returns> public List <TakeOutPathEndInfo> selectTakeOutPathEndList(string key) { log.Debug("=================START selectTakeOutPathEndList================="); log.Debug("key = " + key); List <TakeOutPathEndInfo> list = new List <TakeOutPathEndInfo>(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM TakeOutPathEnd "); 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 takeOutPathEndCode"); //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()) { TakeOutPathEndInfo obj = new TakeOutPathEndInfo(); obj = bindObject(rdr, obj); list.Add(obj); } } log.Debug(@"=================END selectTakeOutPathEndList================="); return(list); }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndCode"></param> /// <returns></returns> public TakeOutPathEndInfo selectTakeOutPathEnd(string takeOutPathEndCode) { log.Debug("=================START selectTakeOutPathEnd================="); log.Debug("takeOutPathEndCode = " + takeOutPathEndCode); TakeOutPathEndInfo obj = new TakeOutPathEndInfo(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM TakeOutPathEnd WHERE takeOutPathEndCode=" + takeOutPathEndCode); using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_select.ToString(), null)) { if (rdr.Read()) { obj = bindObject(rdr, obj); } } log.Debug(@"=================END selectTakeOutPathEnd================="); return(obj); }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndInfo"></param> /// <returns></returns> public int deleteTakeOutPathEnd(TakeOutPathEndInfo takeOutPathEndInfo) { return(dal.deleteTakeOutPathEnd(takeOutPathEndInfo)); }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndInfo"></param> /// <returns></returns> public int insertTakeOutPathEnd(TakeOutPathEndInfo takeOutPathEndInfo) { return(dal.insertTakeOutPathEnd(takeOutPathEndInfo)); }
/// <summary> /// /// </summary> /// <param name="takeOutPathEndInfo"></param> /// <returns></returns> public int updateTakeOutPathEnd(TakeOutPathEndInfo takeOutPathEndInfo) { return(dal.updateTakeOutPathEnd(takeOutPathEndInfo)); }