protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TakeOutObjectInfo obj = (TakeOutObjectInfo)e.Row.DataItem; HyperLink colModify = (HyperLink)e.Row.Cells[2].Controls[0]; colModify.NavigateUrl = "takeOutObjectEdit.aspx?takeOutObjectCode=" + obj.TakeOutObjectCode + "&mode=modify"; colModify.ImageUrl = "~/images/icon/edit.gif"; HyperLink colDelete = (HyperLink)e.Row.Cells[3].Controls[0]; colDelete.NavigateUrl = "#"; colDelete.Attributes.Add("onclick", "return confirmDelete('takeOutObjectDelete.aspx?takeOutObjectCode=" + obj.TakeOutObjectCode + "');"); colDelete.ImageUrl = "~/images/icon/delete.gif"; for (int i = 0; i < e.Row.Cells.Count; i++) { if (i < 2) { e.Row.Cells[i].Attributes.Add("onclick", "window.location='takeOutObjectView.aspx?takeOutObjectCode=" + obj.TakeOutObjectCode + "';"); e.Row.Cells[i].Attributes.Add("style", "cursor:hand"); } } } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <returns></returns> public List <TakeOutObjectInfo> selectTakeOutObjectList(string key) { log.Debug("=================START selectTakeOutObjectList================="); log.Debug("key = " + key); List <TakeOutObjectInfo> list = new List <TakeOutObjectInfo>(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM TakeOutObject "); //sql_select.Append(" WHERE status = 'Y' " + "\n"); if (!String.IsNullOrEmpty(key)) { if (key.Equals("A")) { sql_select.Append(" WHERE status = 'Y' " + "\n"); } else { sql_select.Append("WHERE codeName LIKE '%" + key + "%'"); } } sql_select.Append("ORDER BY codeName"); //sql_select.Append("SELECT takeOutObjectCode,codeName,regDate " + "\n"); //sql_select.Append(" FROM ( " + "\n"); //sql_select.Append(" SELECT ROW_NUMBER() OVER(ORDER BY takeOutObjectCode) AS NUM,* " + "\n"); //sql_select.Append(" FROM TakeOutObject " + "\n"); //sql_select.Append(" WHERE NOT codeName='기 타' " + "\n"); //sql_select.Append(" UNION ALL " + "\n"); //sql_select.Append(" SELECT '999' AS NUM,* " + "\n"); //sql_select.Append(" FROM TakeOutObject " + "\n"); //sql_select.Append(" WHERE codeName='기 타' " + "\n"); //sql_select.Append(" ) a " + "\n"); //if (!String.IsNullOrEmpty(key)) //{ // sql_select.Append("WHERE codeName LIKE '%" + key + "%'"); //} //sql_select.Append("ORDER BY NUM"); //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()) { TakeOutObjectInfo obj = new TakeOutObjectInfo(); obj = bindObject(rdr, obj); list.Add(obj); } } log.Debug(@"=================END selectTakeOutObjectList================="); return(list); }
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); } TakeOutObject bll = new TakeOutObject(); TakeOutObjectInfo takeOutObjectInfo = new TakeOutObjectInfo(); takeOutObjectInfo.TakeOutObjectCode = Convert.ToInt32(Request.QueryString["takeOutObjectCode"]); int result = bll.deleteTakeOutObject(takeOutObjectInfo); Response.Redirect("takeOutObjectList.aspx", true); }
/// <summary> /// /// </summary> /// <param name="rdr"></param> /// <param name="obj"></param> /// <returns></returns> private TakeOutObjectInfo bindObject(SqlDataReader rdr, TakeOutObjectInfo obj) { obj.TakeOutObjectCode = rdr.GetInt32(0); obj.CodeName = rdr.GetString(1); obj.RegDate = rdr.GetDateTime(2); obj.Status = rdr.GetString(3); return(obj); }
protected void Page_Load(object sender, EventArgs e) { // 관리자 체크 check người quản lý 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) { TakeOutObjectInfo takeOutObjectInfo = new TakeOutObjectInfo(); takeOutObjectInfo.TakeOutObjectCode = Convert.ToInt32(Request.QueryString["takeOutObjectCode"]); takeOutObjectInfo.CodeName = txtCodeName.Text; takeOutObjectInfo.Status = txtStatus.Text; // 수정하기 Sửa if (mode.Value.Equals("modify")) { int result = bll.updateTakeOutObject(takeOutObjectInfo); Response.Redirect("takeOutObjectList.aspx"); } // 등록하기 Đăng ký else { int result = bll.insertTakeOutObject(takeOutObjectInfo); Response.Redirect("takeOutObjectList.aspx");; } } else { if (Request.QueryString["mode"].Equals("modify")) { TakeOutObjectInfo takeOutObjectInfo = new TakeOutObjectInfo(); takeOutObjectInfo = bll.selectTakeOutObject(Request.QueryString["takeOutObjectCode"]); txtCodeName.Text = takeOutObjectInfo.CodeName; txtStatus.Text = takeOutObjectInfo.Status; lableCodeName.Text = " Sửa thông tin (정보 수정하기) : " + takeOutObjectInfo.CodeName; mode.Value = Request.QueryString["mode"]; } else { lableCodeName.Text = "Đăng ký (등록하기)"; mode.Value = Request.QueryString["mode"]; } } }
/// <summary> /// /// </summary> /// <param name="takeOutObjectInfo"></param> /// <returns></returns> public int deleteTakeOutObject(TakeOutObjectInfo takeOutObjectInfo) { log.Debug("=================START deleteTakeOutObject================="); log.Debug("takeOutObjectInfo = " + takeOutObjectInfo.ToString()); StringBuilder sql_delete = new StringBuilder(); sql_delete.Append("DELETE FROM TakeOutObject WHERE takeOutObjectCode=" + takeOutObjectInfo.TakeOutObjectCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_delete.ToString(), null); log.Debug(@"=================END deleteTakeOutObject================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutObjectInfo"></param> /// <returns></returns> public int updateTakeOutObject(TakeOutObjectInfo takeOutObjectInfo) { log.Debug("=================START updateTakeOutObject================="); log.Debug("takeOutObjectInfo = " + takeOutObjectInfo.ToString()); StringBuilder sql_update = new StringBuilder(); sql_update.Append("UPDATE TakeOutObject SET codeName=N'" + takeOutObjectInfo.CodeName + "' , status=N'" + takeOutObjectInfo.Status + "' WHERE takeOutObjectCode=" + takeOutObjectInfo.TakeOutObjectCode); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_update.ToString(), null); log.Debug(@"=================END updateTakeOutObject================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutObjectInfo"></param> /// <returns></returns> public int insertTakeOutObject(TakeOutObjectInfo takeOutObjectInfo) { log.Debug("=================START insertTakeOutObject================="); log.Debug("takeOutObjectInfo = " + takeOutObjectInfo.ToString()); StringBuilder sql_insert = new StringBuilder(); sql_insert.Append("INSERT INTO TakeOutObject"); sql_insert.Append(" (codeName,regDate,status) "); sql_insert.Append(" VALUES "); sql_insert.Append(" (N'" + takeOutObjectInfo.CodeName + "', GETDATE(),N'" + takeOutObjectInfo.Status + "')"); int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_insert.ToString(), null); log.Debug(@"=================END insertTakeOutObject================="); return(result); }
/// <summary> /// /// </summary> /// <param name="takeOutObjectCode"></param> /// <returns></returns> public TakeOutObjectInfo selectTakeOutObject(string takeOutObjectCode) { log.Debug(@"=================START selectTakeOutObject================="); log.Debug(@"takeOutObjectCode = " + takeOutObjectCode); TakeOutObjectInfo obj = new TakeOutObjectInfo(); StringBuilder sql_select = new StringBuilder(); sql_select.Append("SELECT * FROM TakeOutObject WHERE takeOutObjectCode=" + takeOutObjectCode); using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_select.ToString(), null)) { if (rdr.Read()) { obj = bindObject(rdr, obj); } } log.Debug(@"=================END selectTakeOutObject================="); 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); } //2011-04-20-김민우: 반출목적 조회 조건에 추가 //thêm điều kiện tra cứu mục đích mang ra #region Data Binding if (cboPurpose.Items.Count == 0) { cboPurpose.Items.Clear(); List <TakeOutObjectInfo> list = bllVisit.selectTakeOutObjectList(null); TakeOutObjectInfo m = new TakeOutObjectInfo(); for (int i = 0; i < list.Count; i++) { m = (TakeOutObjectInfo)list[i]; string a = Convert.ToString(m.TakeOutObjectCode); string b = m.CodeName; if (!String.IsNullOrEmpty(a)) { cboPurpose.Items.Add(new ListItem(b, a)); } } } #endregion }
/// <summary> /// 반출 목적 삭제 /// </summary> /// <param name="takeOutObjectInfo"></param> /// <returns></returns> public int deleteTakeOutObject(TakeOutObjectInfo takeOutObjectInfo) { return(dal.deleteTakeOutObject(takeOutObjectInfo)); }
/// <summary> /// 반출 목적 저장 /// </summary> /// <param name="takeOutObjectInfo"></param> /// <returns></returns> public int insertTakeOutObject(TakeOutObjectInfo takeOutObjectInfo) { return(dal.insertTakeOutObject(takeOutObjectInfo)); }
/// <summary> /// 반출 목적 수정 /// </summary> /// <param name="takeOutObjectInfo"></param> /// <returns></returns> public int updateTakeOutObject(TakeOutObjectInfo takeOutObjectInfo) { return(dal.updateTakeOutObject(takeOutObjectInfo)); }