protected void dgData_EditCommand(object source, DataGridCommandEventArgs e) { ActionHistoryDAL actionDAL = new ActionHistoryDAL(); T_ActionHistory action = new T_ActionHistory(); HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); T_NewsVersion _obj_T_NewsVecion = new T_NewsVersion(); action.UserID = _user.UserID; action.FullName = _user.UserName; action.HostIP = IpAddress(); action.DateModify = DateTime.Now; if (e.CommandArgument.ToString().ToLower() == "edit") { int _ID = Convert.ToInt32(this.dgr_tintuc1.DataKeys[e.Item.ItemIndex].ToString()); LoadDetails(_ID, true, true, e.Item.ItemIndex, true); lbl_index.Text = e.Item.ItemIndex.ToString(); } }
protected void dgData_EditCommand(object source, DataGridCommandEventArgs e) { ActionHistoryDAL actionDAL = new ActionHistoryDAL(); T_ActionHistory action = new T_ActionHistory(); HPCBusinessLogic.DAL.T_NewsDAL tt = new HPCBusinessLogic.DAL.T_NewsDAL(); T_News _obj_T_News = new T_News(); T_NewsVersion _obj_T_NewsVecion = new T_NewsVersion(); action.UserID = _user.UserID; action.FullName = _user.UserName; action.HostIP = IpAddress(); action.DateModify = DateTime.Now; //if (e.CommandArgument.ToString().ToLower() == "edittt") //{ // Label lbl_CL = (Label)e.Item.FindControl("lblchatluong"); // Label lbl_TL = (Label)e.Item.FindControl("lbltheloai"); // Label lbl_CLID = (Label)e.Item.FindControl("lblchatluongID"); // Label lbl_TLID = (Label)e.Item.FindControl("lbltheloaiID"); // DropDownList Drop_CL = (DropDownList)e.Item.FindControl("ddlnews_chatluong"); // DropDownList Drop_TL = (DropDownList)e.Item.FindControl("ddlNews_Theloai"); // ImageButton Image_Edit = (ImageButton)e.Item.FindControl("btnEdit"); // ImageButton Image_Update = (ImageButton)e.Item.FindControl("btnUpdate"); // ImageButton Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel"); // if (lbl_CLID.Text.ToLower() != "null" && !string.IsNullOrEmpty(lbl_CLID.Text)) // Drop_CL.SelectedIndex = int.Parse(lbl_CLID.Text.Trim()); // if (lbl_TLID.Text.ToLower() != "null" && !string.IsNullOrEmpty(lbl_TLID.Text)) // { // if (lbl_TLID.Text.ToLower() != "3" && lbl_TLID.Text.ToLower() != "4") // { // Drop_TL.SelectedIndex = int.Parse(lbl_TLID.Text.Trim()); // Drop_TL.Visible = true; // lbl_TL.Visible = false; // } // } // else // { // Drop_TL.SelectedIndex = 0; // Drop_TL.Visible = true; // lbl_TL.Visible = false; // } // Image_Edit.Visible = false; // Image_Update.Visible = true; // Image_Cancel.Visible = true; // lbl_CL.Visible = false; // Drop_CL.Visible = true; //} //else if (e.CommandArgument.ToString().ToLower() == "update") //{ // Label lbl_CL = (Label)e.Item.FindControl("lblchatluong"); // Label lbl_TL = (Label)e.Item.FindControl("lbltheloai"); // Label lbl_CLID = (Label)e.Item.FindControl("lblchatluongID"); // Label lbl_TLID = (Label)e.Item.FindControl("lbltheloaiID"); // DropDownList Drop_CL = (DropDownList)e.Item.FindControl("ddlnews_chatluong"); // DropDownList Drop_TL = (DropDownList)e.Item.FindControl("ddlNews_Theloai"); // ImageButton Image_Edit = (ImageButton)e.Item.FindControl("btnEdit"); // ImageButton Image_Update = (ImageButton)e.Item.FindControl("btnUpdate"); // ImageButton Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel"); // DropDownList drop_heso = (DropDownList)e.Item.FindControl("Drop_heso"); // int NewsID = int.Parse(dgr_tintuc.DataKeys[e.Item.ItemIndex].ToString()); // lbl_CL.Text = Drop_CL.SelectedItem.Text; // lbl_TL.Text = Drop_TL.SelectedItem.Text; // lbl_CLID.Text = Drop_CL.SelectedIndex.ToString(); // lbl_TLID.Text = Drop_TL.SelectedIndex.ToString(); // Image_Edit.Visible = true; // Image_Update.Visible = false; // Image_Cancel.Visible = false; // lbl_CL.Visible = true; // lbl_TL.Visible = true; // Drop_CL.Visible = false; // Drop_TL.Visible = false; // if (!string.IsNullOrEmpty(lbl_TLID.Text.Trim())) // { // drop_heso.Items.Clear(); // int chatluong = 0; try { chatluong = int.Parse(lbl_CLID.Text.Trim()); } // catch { ;} // int theloai = 0; try { theloai = int.Parse(lbl_TLID.Text.Trim()); } // catch { ;} // string where = " where 1=1 "; // if (chatluong != 0 || theloai != 0) // { // if (theloai == 3 || theloai == 4) // { // if (theloai == 4) // { // where = where + " and LoaiTT_TLID = " + theloai.ToString() + " and LoaiTT_CLID=" + chatluong.ToString(); // } // else // { // where = " where 1=1 LoaiTT_TLID=5 "; // } // } // else // { // where = where + " and LoaiTT_TLID = 1 and LoaiTT_CLID=" + chatluong.ToString() + " and LoaiTT_LoaiTinBai = " + theloai.ToString(); // } // UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", // " 1 = 1 and Heso>= (select LoaiTT_Tuheso from T_LoaihinhTT " + where + " )" + // " and Heso <= (select LoaiTT_Denheso from T_LoaihinhTT " + where + " ) order by Heso", "0"); // } // else // { // UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", // " 1 = 1 and Heso>= 0 and Heso <= 1 order by Heso", "0"); // } // //if (lbl_CLID.Text.Trim() == "1") // //{ // // UltilFunc.BindCombox(drop_heso, "HesoID", "Heso", "T_HesoTT", " 1 = 1 and Heso>= (select LoaiTT_Tuheso from T_LoaihinhTT where LoaiTTID=" + lbl_TLID.Text.Trim() + " and LoaiTT_Type=1 )" + // // " and Heso <= (select LoaiTT_Denheso from T_LoaihinhTT where LoaiTTID=" + lbl_TLID.Text.Trim() + " and LoaiTT_Type=1 ) order by Heso", "0"); // //} // //else // //{ // // drop_heso.DataSource = null; // // drop_heso.DataBind(); // //} // } // HPCBusinessLogic.DAL.T_NewsDAL obj = new HPCBusinessLogic.DAL.T_NewsDAL(); // obj.Update_Theloai_News(NewsID, Drop_TL.SelectedIndex, Drop_CL.SelectedIndex); //} //else if (e.CommandArgument.ToString().ToLower() == "back") //{ // Label lbl_CL = (Label)e.Item.FindControl("lblchatluong"); // Label lbl_TL = (Label)e.Item.FindControl("lbltheloai"); // DropDownList Drop_CL = (DropDownList)e.Item.FindControl("ddlnews_chatluong"); // DropDownList Drop_TL = (DropDownList)e.Item.FindControl("ddlNews_Theloai"); // ImageButton Image_Edit = (ImageButton)e.Item.FindControl("btnEdit"); // ImageButton Image_Update = (ImageButton)e.Item.FindControl("btnUpdate"); // ImageButton Image_Cancel = (ImageButton)e.Item.FindControl("btnCancel"); // Image_Edit.Visible = true; // Image_Update.Visible = false; // Image_Cancel.Visible = false; // lbl_CL.Visible = true; // lbl_TL.Visible = true; // Drop_CL.Visible = false; // Drop_TL.Visible = false; //} //else if (e.CommandArgument.ToString().ToLower() == "view") //{ // Label lbl_TL = (Label)e.Item.FindControl("lbltheloaiID"); // Label lbl_ID = (Label)e.Item.FindControl("lbl_ID"); // if (!String.IsNullOrEmpty(lbl_TL.Text)) // { // string js = ""; // if (lbl_TL.Text.Trim() == "3") // { // js = "alert('Trường ngày tháng phải nhập đúng theo định dang dd/MM/yyyy!');"; // } // else if (lbl_TL.Text.Trim() == "4") // { // js = "alert('Trường ngày tháng phải nhập đúng theo định dang dd/MM/yyyy!');"; // } // else // { // js = "Javascript:open_window_Scroll('" + Global.ApplicationPath // + "/Article/ViewAndPrint.aspx?Menu_ID=" // + Page.Request.QueryString["Menu_ID"].ToString() + // "&ID=" + lbl_ID.Text.Trim()+"',50,500,100,800);"; // } // System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), " ", js, true); // } //} //Search(); }