protected void DataGrid_Update(Object sender, DataGridCommandEventArgs E) { #region 更新相关的图标信息 int id = Utils.StrToInt(DataGrid1.DataKeys[E.Item.ItemIndex].ToString(), 0); int displayorder = Utils.StrToInt(((TextBox)E.Item.Cells[3].Controls[0]).Text, 0); string code = ((TextBox)E.Item.Cells[5].Controls[0]).Text; string url = ((TextBox)E.Item.Cells[6].Controls[0]).Text; AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "表情文件更新", code); try { DatabaseProvider.GetInstance().UpdateSmilies(id, displayorder, 1, code, url); BindData(); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/IconsList"); } catch { base.RegisterStartupScript( "", "<script>alert('无法更新数据库.');window.location.href='forum_iconfilegrid.aspx';</script>"); return; } #endregion }
protected void grdContact_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; List<Data.Contact> listE = ContactService.Contact_GetById(Id); txtName.Text = listE[0].Name; txtCompany.Text = listE[0].Company; txtAddress.Text = listE[0].Address; txtTel.Text = listE[0].Tel; txtMail.Text = listE[0].Mail; fckDetail.Value = listE[0].Detail; txtDate.Text = DateTimeClass.ConvertDateTime(listE[0].Date); chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update Contact set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": ContactService.Contact_Delete(strCA); BindGrid(); break; } }
protected void GridView1_UpdateCommand(object source, DataGridCommandEventArgs e) { if (((DropDownList)this.GridView1.Items[e.Item.ItemIndex].Cells[3].FindControl("drgDept")).SelectedIndex == 0) { CallJsFun("alert('请选择标识所属部门!');"); return; } DL.DLEntity().L_NAME = ((TextBox)e.Item.Cells[0].FindControl("txtName")).Text.Trim(); DL.DLEntity().MAINDEPT = ((DropDownList)this.GridView1.Items[e.Item.ItemIndex].Cells[3].FindControl("drgDept")).SelectedItem.Value; DL.DLEntity().MAINDEPT_NAME = ((DropDownList)this.GridView1.Items[e.Item.ItemIndex].Cells[3].FindControl("drgDept")).SelectedItem.Text; DL.DLEntity().FILEHEAD = ((TextBox)e.Item.Cells[1].FindControl("txtDocHead")).Text.Trim(); DL.DLEntity().PRINTHEAD = ((TextBox)e.Item.Cells[2].FindControl("txtPrintHead")).Text.Trim(); DL.DLEntity().SEQ = ((TextBox)e.Item.Cells[5].FindControl("txtSeq")).Text.Trim() == "" ? 0 : Convert.ToInt32(((TextBox)e.Item.Cells[5].FindControl("txtSeq")).Text.Trim()); DL.DLEntity().ISALL = (((CheckBox)this.GridView1.Items[e.Item.ItemIndex].Cells[4].FindControl("chkAll")).Checked) ? "1" : "0"; DL.DLEntity().S_R_STATUS = ((DropDownList)this.GridView1.Items[e.Item.ItemIndex].Cells[4].FindControl("drgSR")).SelectedItem.Value; DL.DLEntity().L_ID = ((Label)e.Item.Cells[11].FindControl("lblL_ID")).Text; int intFlag = DL.UpdateDocLogo(); if (intFlag < 1) { CallJsFun("alert('由于网络原因,本次更新失败,请联系信息中心技术支持人员!');"); return; } CallJsFun("alert('修改成功!');"); this.GridView1.EditItemIndex = -1; this.InitiData(); }
/// <summary> /// Handles the ItemCommand event of the grdPriorities control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> protected void grdPriorities_ItemCommand(object sender, DataGridCommandEventArgs e) { Priority p; var itemIndex = e.Item.ItemIndex; switch (e.CommandName) { case "up": //move row up if (itemIndex == 0) return; p = PriorityManager.GetById(Convert.ToInt32(grdPriorities.DataKeys[e.Item.ItemIndex])); p.SortOrder -= 1; PriorityManager.SaveOrUpdate(p); break; case "down": //move row down if (itemIndex == grdPriorities.Items.Count - 1) return; p = PriorityManager.GetById(Convert.ToInt32(grdPriorities.DataKeys[e.Item.ItemIndex])); p.SortOrder += 1; PriorityManager.SaveOrUpdate(p); break; } BindPriorities(); }
protected void GridView1_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "DEL") { int intFlag = CSSD.Delete(((Label)e.Item.FindControl("lbl_ID")).Text); if (intFlag < 1) { CallJsFun("alert('由于网络原因,本次删除失败,请联系信息中心技术支持人员!');"); return; } CallJsFun("alert('删除成功!');"); this.IntiData(); } if (e.CommandName == "SUBMIT") { bool IsPause = ((Label)e.Item.FindControl("lbl_Status")).Text == "4" ? true : false; int flag = CSSD.Submit("Caw_CompanyServerShip_Add.aspx", ((Label)e.Item.FindControl("lbl_ID")).Text, Session["UserID"].ToString(), Session["RealName"].ToString(), Session["ORGID"].ToString(), Session["CompanyName"].ToString(), "1", IsPause); if (flag < 1) { CallJsFun("alert('由于网络原因,本次提交失败,请联系信息中心技术支持人员!');"); return; } CallJsFun("alert('成功提交');window.close();"); this.IntiData(); } }
protected void dgLicence_ItemCommand(object source, DataGridCommandEventArgs e) { string Licence_Id = "'" + e.Item.Cells[7].Text.Trim() + "'"; if (e.CommandName == "MAN") { int intFlag = LicenceDB.SetManCheck(Licence_Id); if (intFlag < 1) { this.ShowJsMessage("设置手工审批出错"); return; } this.ShowJsMessage("设置手工审批成功"); refreshGrid(); UpdatePanel1.Update(); } if (e.CommandName == "AUTO") { int intFlag = LicenceDB.SetAutoCheck(Licence_Id); if (intFlag < 1) { this.ShowJsMessage("设置自动审批出错"); return; } this.ShowJsMessage("设置自动审批成功"); refreshGrid(); UpdatePanel1.Update(); } }
protected void GridView1_EditCommand(object source, DataGridCommandEventArgs e) { this.GridView1.EditItemIndex = e.Item.DataSetIndex; InitiData(); DL.InitGroupDrgList((DropDownList)this.GridView1.Items[e.Item.ItemIndex].Cells[3].FindControl("drgDept"), Session["ORGID"].ToString()); ((CheckBox)this.GridView1.Items[e.Item.ItemIndex].Cells[4].FindControl("chkAll")).Checked = ((Label)e.Item.Cells[12].FindControl("lblAll")).Text == "1" ? true : false; }
protected void AgenciesDataGrid_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName.Equals("AgencyDetail")) { Response.Redirect(string.Format("AgencyInfo?Code={0}", e.Item.Cells[1].Text)); } }
protected void grdLanguage_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; List<Data.Language> listE = LanguageService.Language_GetById(Id); txtName.Text = listE[0].Name; txtFolder.Text = listE[0].Folder; chkDefault.Checked = listE[0].Default == "1" || listE[0].Default == "True"; txtImage.Text = listE[0].Image; imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : ""; chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update Language set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": LanguageService.Language_Delete(strCA); BindGrid(); break; } }
protected void dgList_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "id") { txtCustID.Text = e.Item.Cells[4].Text.Trim(); var cust = customer.GetDataByID(con.cn, Convert.ToInt32(txtCustID.Text)); txtUsername.Text = cust.Fields["username"].Value.ToString(); txtCustName.Text = cust.Fields["ClName"].Value.ToString(); txtEmail.Text = cust.Fields["Email"].Value.ToString(); txtAddress.Text = cust.Fields["Address"].Value.ToString(); txtCity.Text = cust.Fields["CityName"].Value.ToString(); txtProvince.Text = cust.Fields["ProvinceName"].Value.ToString(); txtPostalCode.Text = cust.Fields["PostalCode"].Value.ToString(); txtPhone.Text = cust.Fields["Phone"].Value.ToString(); cmbCustomerLevel.SelectedValue = cust.Fields["UserLevel"].Value.ToString(); cmbStatus.SelectedValue = cust.Fields["Active"].Value.ToString(); } txtCustID.Enabled = false; txtUsername.Enabled = false; txtCustName.Enabled = false; txtEmail.Enabled = false; txtAddress.Enabled = false; txtCity.Enabled = false; txtProvince.Enabled = false; txtPostalCode.Enabled = false; txtPhone.Enabled = false; trUpdate.Visible = true; trCreate.Visible = false; }
/// <summary> /// Handles the ItemCommand event of the grdStatus control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> protected void grdStatus_ItemCommand(object sender, DataGridCommandEventArgs e) { Status s; var itemIndex = e.Item.ItemIndex; switch (e.CommandName) { case "up": //move row up if (itemIndex == 0) return; s = StatusManager.GetById(Convert.ToInt32(grdStatus.DataKeys[e.Item.ItemIndex])); s.SortOrder -= 1; StatusManager.SaveOrUpdate(s); break; case "down": //move row down if (itemIndex == grdStatus.Items.Count - 1) return; s = StatusManager.GetById(Convert.ToInt32(grdStatus.DataKeys[e.Item.ItemIndex])); s.SortOrder += 1; StatusManager.SaveOrUpdate(s); break; } BindStatus(); }
protected void grdLink_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; List<Data.Link> listE = LinkService.Link_GetById(Id); txtName.Text = listE[0].Name; txtLine1.Text = listE[0].Line1; txtLine2.Text = listE[0].Line2; txtLink1.Text = listE[0].Link1; txtLink2.Text = listE[0].Link2; txtPosition.Text = listE[0].Position; txtOrd.Text = listE[0].Ord; chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update Link set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": LinkService.Link_Delete(strCA); BindGrid(); break; } }
private void dgResellers_DeleteCommand(object source, DataGridCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); CManage.DeleteReseller(id); BindDGResellers(); }
protected void dgGroupBans_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Unban") { GroupBan.Delete(Convert.ToInt32(e.CommandArgument)); } }
protected void LoanListDataGrid_ItemCommand(object source, DataGridCommandEventArgs e) { string id = string.Empty; if (e.CommandName == "LoanImageDelete") { int selectindex = e.Item.ItemIndex; id = this.LoanListDataGrid.Items[selectindex].Cells[0].Text; } // Response.Write("<script> if(confirm('是否删除')) document.getElementById('HidderField2').value='1';</script>"); if (!string.IsNullOrEmpty(id) && this.deleteflag == true) { int iSuccess = LoanMethods.DeleteLoanById(Convert.ToInt32(id)); if (iSuccess > 0) { Alert.Show(this, "删除成功!"); } else { Alert.Show(this, "删除失败!"); } if (queryList == null) { queryList = new List<QueryElement>(); } BindLoanListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "HideORShowColumn();", true); } }
protected void GridView1_Command(object source, DataGridCommandEventArgs e) { string BGuid = GridView1.DataKeys[e.Item.ItemIndex].ToString(); if (e.CommandName.ToUpper() == "CANCEL") { int Flag = DYD.Delete(BGuid); if (Flag > 0) { this.ShowJsMessage("成功删除"); InitiData(); } else { this.ShowJsMessage("删除失败,请重试"); } } if (e.CommandName.ToUpper() == "UP") { int Flag = DYD.Up_Data(e.Item.Cells[0].Text.Trim()); if (Flag > 0) { if (DYD.CheckExistHead(e.Item.Cells[0].Text.Trim())) { DYD.InsertHead(e.Item.Cells[0].Text.Trim()); } InitiData(); this.ShowJsMessage("成功上报"); } else { this.ShowJsMessage("上报失败,请重试"); } } }
protected void DataGrid1_Command(object source, DataGridCommandEventArgs e) { string Guid = DataGrid1.DataKeys[e.Item.ItemIndex].ToString(); if (e.CommandName == "Delete") { new ReportUpload().DeleteReport(Guid); ShowJsMessage("删除成功 ."); } else if (e.CommandName == "UpLoad") //上传口岸委 { new ReportUpload().UpdateTableStatus(Guid, "1"); } Refresh(); //string AssetsGuid = GridView1.DataKeys[e.Item.ItemIndex].ToString(); //if (!AM.HasAssetsOut(AssetsGuid)) //{ // AM.DeleteAssetsItem(AssetsGuid); // this.Refresh(); //} //else //{ // ShowJsMessage("有资产外借未处理,不能删除."); //} }
protected void grdLibrary_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; List<Data.Library> listE = LibraryService.Library_GetById(Id); txtName.Text = listE[0].Name; txtImage.Text = listE[0].Image; imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : ""; txtFile.Text = listE[0].File; fckInfo.Value = listE[0].Info; chkPriority.Checked = listE[0].Priority == "1" || listE[0].Priority == "True"; chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; LoadGroupLibraryDropDownList(); ddlGroupLibrary.Text = listE[0].GroupLibraryId; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update [Library] set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": LibraryService.Library_Delete(strCA); BindGrid(); break; } }
protected void GridItemList_ItemCommand(object source, DataGridCommandEventArgs e) { if (((LinkButton)e.CommandSource).CommandName == "Delete") { EventDelete(e); } }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { DataTable dt1 = new DataTable(); if (e.CommandName == "select") { TableRow a = new TableRow(); a = e.Item; dt1 = gcgl.csd_query1(a.Cells[1].Text); if (dt1.Rows.Count > 0) { DataRow dr = dt1.Rows[0]; Session["id"] = a.Cells[1].Text; this.ssqd.Text = dr["所属渠道"].ToString(); this.xz.Text = dr["形状"].ToString(); this.csdmc.Text = dr["沉沙池名称"].ToString(); this.qszh.Text = dr["起始桩号"].ToString(); this.cd.Text = dr["长度(米)"].ToString(); this.zdmj.Text = dr["占地面积(平方米)"].ToString(); this.sjcskr.Text = dr["设计沉沙库容(立方米)"].ToString(); this.xycskr.Text = dr["现有沉沙库容(立方米)"].ToString(); this.zyzy.Text = dr["主要作用"].ToString(); this.gldw.Text = dr["管理单位"].ToString(); this.jssj.Text = dr["建设时间"].ToString(); this.yxzk.Text = dr["运行状况"].ToString(); this.bzsm.Text = dr["备注说明"].ToString(); } } }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { DataTable dt1 = new DataTable(); if (e.CommandName == "select") { TableRow a = new TableRow(); a = e.Item; dt1 = gcgl.db_query(a.Cells[1].Text); if (dt1.Rows.Count > 0) { DataRow dr = dt1.Rows[0]; Session["id"] = a.Cells[1].Text; this.dbmc.Text = dr["大坝名称"].ToString(); this.dlwz.Text = dr["地理位置"].ToString(); this.dblx.Text = dr["大坝类型"].ToString(); this.gcdj.Text = dr["工程等级"].ToString(); this.dbgd.Text = dr["大坝高度(米)"].ToString(); this.dbcd.Text = dr["大坝长度(米)"].ToString(); this.dbzy.Text = dr["大坝作用"].ToString(); this.jzcl.Text = dr["建筑材料"].ToString(); this.gldw.Text = dr["管理单位"].ToString(); this.jssj.Text = dr["建设时间"].ToString(); this.yxzk.Text = dr["运行状况"].ToString(); this.bzsm.Text = dr["备注说明"].ToString(); } } }
protected void grdMember_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; List<Data.Member> listE = MemberService.Member_GetById(Id); txtName.Text = listE[0].Name; txtEmail.Text = listE[0].Email; txtUsername.Text = listE[0].Username; txtPassword.Text = ""; Password = listE[0].Password; chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; LoadGroupMemberDropDownList(); ddlGroupMember.Text = listE[0].GroupMemberId; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update [Member] set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": MemberService.Member_Delete(strCA); BindGrid(); break; } }
protected void GridView1_UpdateCommand(object source, DataGridCommandEventArgs e) { TextBox txtName = (TextBox)GridView1.Items[e.Item.ItemIndex].FindControl("txtTypeName"); TextBox txtNote = (TextBox)GridView1.Items[e.Item.ItemIndex].FindControl("txtTypeNote"); if (txtName.Text.Trim() == "") { ShowJsMessage("�������Ʊ�����д��"); return; } string TypeGuid = GridView1.DataKeys[e.Item.ItemIndex].ToString(); //�ж��Ƿ���ڣ�ֻ�в����ڲ��ܸ��� if (!AM.IsAssetsTypeExists(txtName.Text.Trim(), TypeGuid)) { AM.UpdateAssetsType(TypeGuid, txtName.Text.Trim(), txtNote.Text.Trim()); } else { ShowJsMessage("�����������Ѿ����ڣ���ʹ���������ƣ�"); return; } GridView1.EditItemIndex = -1; this.Refresh(); }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { DataTable dt1 = new DataTable(); if (e.CommandName == "select") { TableRow a = new TableRow(); a = e.Item; dt1 = gcgl.dhx_query(a.Cells[1].Text); if (dt1.Rows.Count > 0) { DataRow dr = dt1.Rows[0]; Session["id"] = a.Cells[1].Text; this.qsmc.Text = dr["倒虹吸名称"].ToString(); this.dlwz.Text = dr["所属渠道"].ToString(); this.gclx.Text = dr["起始桩号"].ToString(); this.sqsy.Text = dr["倒虹吸长度(米)"].ToString(); this.qsll.Text = dr["设计流量(立方米/秒)"].ToString(); this.qszc.Text = dr["布置型式"].ToString(); this.gj.Text = dr["管径(米)"].ToString(); this.cz.Text = dr["材质"].ToString(); this.lx.Text = dr["断面类型"].ToString(); this.dc.Text = dr["洞长(米)"].ToString(); this.dg.Text = dr["洞高(米)"].ToString(); this.dk.Text = dr["洞宽(米)"].ToString(); this.bj.Text = dr["半径(米)"].ToString(); this.xc.Text = dr["吸差(米)"].ToString(); this.gldw.Text = dr["管理单位"].ToString(); this.jssj.Text = dr["建设时间"].ToString(); this.yxzk.Text = dr["运行状况"].ToString(); this.bzsm.Text = dr["备注说明"].ToString(); } } }
//生成事件时 protected void dgExamProj_ItemCommand(object source, DataGridCommandEventArgs e) { string strArgument = e.CommandArgument.ToString(); if (e.CommandName == "delete") { string id = e.CommandArgument.ToString(); QPS.NEW.BLL.Enterprise ep = new QPS.NEW.BLL.Enterprise(); try { ep.DeleteById(Convert.ToInt32(id)); Bind(); } catch (Exception ex) { } } if (e.CommandName == "LinkTo") { //Label lab = ((Label)e.Item.FindControl("lblPack")); Response.Redirect("RoomUpdate.aspx?id=" + e.CommandArgument.ToString()); } if (e.CommandName == "Ifchecked") { string[] Argument = strArgument.Split('|'); string id = Argument[0].ToString(); string examine = Argument[1].ToString(); NEW.BLL.Enterprise ep = new QPS.NEW.BLL.Enterprise(); ep.UpdateChecked(id, examine); Bind(); } }
protected void DeleteUser(object source, DataGridCommandEventArgs e) { var id = EntitiesGrid.DataKeys[e.Item.ItemIndex]; PersonEdit.Instance.Delete((int)id); GetByFilter(); }
protected void EditUser(object source, DataGridCommandEventArgs e) { var id = EntitiesGrid.DataKeys[e.Item.ItemIndex]; var url = ResolveUrl("../User/AddUser.aspx?code=" + id); Response.Redirect(url); }
protected void Grid_CartCommand(Object sender, DataGridCommandEventArgs e) { if(e.CommandName == "Edit") { ((AdminUsers)Parent).EditUser(userList.User[e.Item.ItemIndex].login); } }
protected void grdtbCUSTOMERS_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; List<Data.tbCUSTOMERS> listE = tbCUSTOMERSService.tbCUSTOMERS_GetById(Id); txtvpassword.Text = listE[0].vpassword; txtvcusname.Text = listE[0].vcusname; txtdbirthday.Text = listE[0].dbirthday; txtvprovince.Text = listE[0].vprovince; txtvaddress.Text = listE[0].vaddress; txtvmobile.Text = listE[0].vmobile; txtvemail.Text = listE[0].vemail; pnView.Visible = false; pnUpdate.Visible = true; break; case "Delete": try { tbCUSTOMERSService.tbCUSTOMERS_Delete(strCA); } catch { Common.WebMsgBox.Show("Khách hàng đã từng mua hàng không thể xóa"); return; } BindGrid(); break; } }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { DataTable dt1 = new DataTable(); if (e.CommandName == "select") { TableRow a = new TableRow(); a = e.Item; dt1 = gcgl.ql_query(a.Cells[1].Text); if (dt1.Rows.Count > 0) { DataRow dr = dt1.Rows[0]; Session["id"] = a.Cells[1].Text; this.ssqd.Text = dr["所属渠道"].ToString(); this.qlmc.Text = dr["桥梁名称"].ToString(); this.zh.Text = dr["桩号"].ToString(); this.qk.Text = dr["桥宽(米)"].ToString(); this.qc.Text = dr["桥长(米)"].ToString(); this.zkd.Text = dr["总跨度(米)"].ToString(); this.ks.Text = dr["孔数(孔)"].ToString(); this.dkjk.Text = dr["单孔净宽(米)"].ToString(); this.qxjk.Text = dr["桥下净空(米)"].ToString(); this.jgxs.Text = dr["结构型式"].ToString(); this.gsnl.Text = dr["过水能力(立方米/秒)"].ToString(); this.jzcl.Text = dr["建筑材料"].ToString(); this.sjhz.Text = dr["设计荷载"].ToString(); this.gldw.Text = dr["管理单位"].ToString(); this.yxsj.Text = dr["建设时间"].ToString(); this.yxzk.Text = dr["运行状况"].ToString(); this.bzsm.Text = dr["备注说明"].ToString(); } } }
private void dgCatalogo_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { dgCatalogo.EditItemIndex = -1; cargarTabla(); }
private void dgData_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { dgData.EditItemIndex = -1; databind(); }
private void dtgUnidadNegocio_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { BindGrid(dtgUnidadNegocio.CurrentPageIndex); this.dtgUnidadNegocio.EditItemIndex = e.Item.ItemIndex; this.dtgUnidadNegocio.DataBind(); }
private void dtgUnidadNegocio_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.dtgUnidadNegocio.EditItemIndex = -1; BindGrid(dtgUnidadNegocio.CurrentPageIndex); }
private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { DataGrid1.EditItemIndex = -1; BindDataGrid(); }
protected void labelsGrid_Edit(System.Object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e) { labelsGrid.EditItemIndex = e.Item.ItemIndex; labelsGridBind(); }
private void dgCatalogo_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { System.Web.UI.WebControls.Label Label1; System.Web.UI.WebControls.TextBox txtDescripcion; System.Web.UI.WebControls.TextBox txtUbicacion; System.Web.UI.WebControls.DropDownList cboOficinaEdit; System.Web.UI.WebControls.CheckBox chkReunion; System.Web.UI.WebControls.CheckBox chkVideo; System.Web.UI.WebControls.TextBox txtCarac; //System.Web.UI.WebControls.CheckBox chkRequisitos; System.Web.UI.WebControls.TextBox txtRequisitos; System.Web.UI.WebControls.DropDownList cboRequisitos; int intInsertResult; string strDescripcion, strUbicacion, strCarac, strRequisitos; int nCodigo, nCodigoOficina, nReunion, nVideo, nRequisitos; Label1 = (Label)e.Item.Cells[0].FindControl("lblCodigo"); cboOficinaEdit = (DropDownList)e.Item.Cells[0].FindControl("cboOficinaEdit"); txtDescripcion = (TextBox)e.Item.Cells[0].FindControl("txtDescripcion"); txtUbicacion = (TextBox)e.Item.Cells[0].FindControl("txtUbicacion"); chkReunion = (CheckBox)e.Item.Cells[0].FindControl("chkReunion"); chkVideo = (CheckBox)e.Item.Cells[0].FindControl("chkVideo"); txtCarac = (TextBox)e.Item.Cells[0].FindControl("txtCarac"); //chkRequisitos = (CheckBox)e.Item.Cells[0].FindControl("chkRequisitos"); txtRequisitos = (TextBox)e.Item.Cells[0].FindControl("txtRequisitos"); cboRequisitos = (DropDownList)e.Item.Cells[0].FindControl("cboRequisitos"); nCodigo = int.Parse(Label1.Text); strDescripcion = txtDescripcion.Text; nCodigoOficina = int.Parse(cboOficinaEdit.SelectedValue); strUbicacion = txtUbicacion.Text; if (chkReunion.Checked == true) { nReunion = 1; } else { nReunion = 0; } if (chkVideo.Checked == true) { nVideo = 1; } else { nVideo = 0; } strCarac = txtCarac.Text; //if (chkRequisitos.Checked == true) nRequisitos = 1; //else nRequisitos = 0; nRequisitos = int.Parse(cboRequisitos.SelectedValue); strRequisitos = txtRequisitos.Text; //Como hace un executenonquery, recoge un entero con el número de filas afectadas. try { RecursoFisico objRF = new RecursoFisico(nCodigo, nCodigoOficina, strDescripcion, strUbicacion, nReunion, nVideo, strCarac, nRequisitos, strRequisitos); intInsertResult = objRF.Actualizar(); if (HttpContext.Current.Cache["cr2_salas"] != null) { HttpContext.Current.Cache.Remove("cr2_salas"); } } catch (Exception ex) { sErrores = Errores.mostrarError("Error al actualizar los datos:", ex); } dgCatalogo.EditItemIndex = -1; cargarTabla(); }
protected void dgCancel_Student(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { dgStudent.EditItemIndex = -1; SetupStudent(); }
private void blogRollGrid_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { outlineCollection.RemoveAt(e.Item.DataSetIndex); StoreEditItemIndexInViewState(blogRollGrid.EditItemIndex = -1); Bind(); }
protected void dgStudent_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e) { Student student = new Student(); if (e.CommandName == "AddStudent") { TextBox txtTempStudentID = (TextBox)e.Item.Cells[0].FindControl("txtStudentIDNew"); DropDownList txtTempYear = (DropDownList)e.Item.Cells[1].FindControl("ddlYearNew"); DropDownList txtTempIntake = (DropDownList)e.Item.Cells[2].FindControl("ddlIntakeNew"); DropDownList txtTempProgramme = (DropDownList)e.Item.Cells[3].FindControl("ddlProgrammeIDNew"); TextBox txtTempName = (TextBox)e.Item.Cells[4].FindControl("txtNameNew"); TextBox txtTempPhone = (TextBox)e.Item.Cells[5].FindControl("txtPhoneNew"); //Validation for name (No digit allowed and only up to 30 characters) Regex nameRegex = new Regex(@"[a-zA-Z ]{1,30}$"); Match checkName = nameRegex.Match(txtTempName.Text); //Validation for phone (Only 10-11 digit is allowed) Regex phoneRegex = new Regex(@"^(01)[0-9]*[0-9]{8,9}$"); Match checkPhone = phoneRegex.Match(txtTempPhone.Text); if (txtTempName.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Please fill in the student name!', 'error')</script>'"); } else if (txtTempStudentID.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Please fill in the student ID!', 'error')</script>'"); } else if (!checkName.Success) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'The Admin Name is not allowed. Admin name is only support character, space and up to 30 characters only.', 'error')</script>'"); } else if (!checkPhone.Success) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'The phone number is not allowed. Phone number must start with 01 and is only support 7 or 8 digits', 'error')</script>'"); } else { if (student.Add(txtTempStudentID.Text, txtTempYear.Text, txtTempIntake.Text, txtTempProgramme.Text, txtTempName.Text, txtTempPhone.Text) == false) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Cannot have same duplicate student ID!', 'error')</script>'"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Added!', text: 'This " + txtTempName.Text + " student is added successfully, your new password is (holdDoc)', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'manageStudent.aspx'; }});</script>'"); } } } else if (e.CommandName == "DeleteStudent") { Label rowStudentID = (Label)e.Item.Cells[0].FindControl("lblStudentID"); if (student.DeleteStudent(rowStudentID.Text) == false) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Delete this student record unsuccessfully', 'error')</script>'"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Deleted!', text: 'Deleted this student record successfully', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'manageStudent.aspx'; }});</script>'"); } } else if (e.CommandName == "ResetPassword") { Label rowStudentID = (Label)e.Item.Cells[0].FindControl("lblStudentID"); if (student.ResetPassword(rowStudentID.Text) == false) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Reset Password unsuccessfully', 'error')</script>'"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Reset!', text: 'Reset Password successfully, your new password is (holdDoc)', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'manageStudent.aspx'; }});</script>'"); } } }
private void DataGridScore_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { DataGridScore.EditItemIndex = -1; ShowData(strSql); }
public void dgCommand_onClick(System.Object o, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string strCommandName; int intId, intItemId; strCommandName = e.CommandName; intId = e.Item.ItemIndex; //delete an item if (strCommandName == "cmdDelete") { intItemId = (int)dbgrid.DataKeys[intId]; signaturesDataAccess.delete(intItemId); dbGrid_bind(); } if (strCommandName == "cmdUpdate") { intItemId = (int)dbgrid.DataKeys[intId]; objSignatures.id = intItemId; objSignatures.populate(); txtSignatureName.Text = "" + objSignatures.signatureName; txtSignatureValue.Text = "" + objSignatures.signatureValue; if (objSignatures.signatureOperator == "=") { radOperatorEquals.Checked = true; } else { radOperatorNotEqual.Checked = true; } if (objSignatures.signatureType == 0) { radStringMatch.Checked = true; radRegex.Checked = false; } else { radRegex.Checked = true; radStringMatch.Checked = false; } txtSignatureDescription.Text = "" + objSignatures.signatureDescription; txtSignatureMessage.Text = "" + objSignatures.signatureMessage; txtSignatureOrder.Text = "" + objSignatures.signatureOrder.ToString(); radInfo.Checked = false; radWarning.Checked = false; radCritical.Checked = false; switch (objSignatures.signatureMessageType) { case 0: radInfo.Checked = true; break; case 1: radWarning.Checked = true; break; case 2: radCritical.Checked = true; break; } lblHiddenId.Text = intItemId.ToString(); cmdAdd.Text = "Update"; panelAdd.Visible = true; } }
private void dtgSolicitudRetiro_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { }
private void blogRollGrid_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { StoreEditItemIndexInViewState(blogRollGrid.EditItemIndex = -1); Bind(); }
private void DataGridNews_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { DataGridNews.EditItemIndex = (int)e.Item.ItemIndex; ShowData(strSql); }
private void DataGridRicerca_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { int itemId = Int16.Parse(e.CommandArgument.ToString()); try { Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti(); int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_addetto_id = new S_Object(); s_addetto_id.ParameterName = "p_addetto_id"; s_addetto_id.DbType = CustomDBType.Integer; s_addetto_id.Direction = ParameterDirection.Input; s_addetto_id.Index = 0; s_addetto_id.Value = 0; S_Controls.Collections.S_Object s_giorno_id = new S_Object(); s_giorno_id.ParameterName = "p_giorno_id"; s_giorno_id.DbType = CustomDBType.Integer; s_giorno_id.Direction = ParameterDirection.Input; s_giorno_id.Index = 1; s_giorno_id.Value = 0; S_Controls.Collections.S_Object s_orain = new S_Object(); s_orain.ParameterName = "p_orain"; s_orain.DbType = CustomDBType.VarChar; s_orain.Direction = ParameterDirection.Input; s_orain.Index = 2; s_orain.Value = "%"; S_Controls.Collections.S_Object s_oraout = new S_Object(); s_oraout.ParameterName = "p_oraout"; s_oraout.DbType = CustomDBType.VarChar; s_oraout.Direction = ParameterDirection.Input; s_oraout.Index = 3; s_oraout.Value = "%";; _SCollection.Add(s_addetto_id); _SCollection.Add(s_giorno_id); _SCollection.Add(s_orain); _SCollection.Add(s_oraout); string s_operazione = "Delete"; i_RowsAffected = _Addetti.ExecuteUpdateAddRep(_SCollection, s_operazione, itemId); if (i_RowsAffected == -1) { //Server.Transfer("RepAddetti.aspx"); Ricerca(); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); //PanelMess.ShowError(s_Err, true); } }
protected void dgOrders_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string bvin = dgOrders.DataKeys[e.Item.ItemIndex].ToString(); Response.Redirect("~/BVadmin/Orders/ViewOrder.aspx?id=" + bvin); }
protected void dgCancel_Year(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { dgYear.EditItemIndex = -1; SetupYear(); }
private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.DataGrid1.EditItemIndex = e.Item.ItemIndex; BindGrid(); }
// Grid Edit Command private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { DataGrid1.EditItemIndex = e.Item.ItemIndex; filldata(); }
public DataGridSortCommandEventArgs(object commandSource, DataGridCommandEventArgs dce) { this.commandSource = commandSource; this.sortExpression = (string)dce.CommandArgument; }
public DataGridSortCommandEventArgs(Object commandSource, DataGridCommandEventArgs dce) { }
private void dgComments_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { dgComments.EditItemIndex = -1; BindComments(); lblErrorMessage.Visible = false; }
/// <summary> /// /// </summary> /// <param name="source"></param> /// <param name="e"></param> private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { if (e.CommandName.Equals("Area")) { this.DataGrid1.SelectedIndex = e.Item.ItemIndex; DocsPaWR.InfoDocumento infoDocumento = this.GetDocumentoSelezionato(); string h = Request.Form["hd1"]; if (this.hd1.Value.Equals("Yes")) { DocsPaWR.SchedaDocumento schedaDocumento = DocumentManager.getDettaglioDocumento(this, this.IdProfile, this.DocNumber); //se ho attiva la nuova ADL devo invertire la funzionalità if (this.RicercaAdl) { DocumentManager.eliminaDaAreaLavoro(this, schedaDocumento.systemId, null); //riavvio la ricerca string fromPage = Request.QueryString["from"].ToString(); ClientScript.RegisterStartupScript(this.GetType(), "LanciaRic", "top.principale.document.location = 'gestioneRicDoc.aspx?tab=" + fromPage + "&ricADL=1&from=" + fromPage + "';", true); } else //normale comportamento { DocumentManager.addAreaLavoro(this, schedaDocumento); //setto le proprietà video ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).ToolTip = "Elimina questo documento da 'Area di lavoro'"; ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).ImageUrl = "../images/proto/cancella.gif"; ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).Attributes.Add("OnClick", "ApriModalDialogNewADL();"); ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).CommandName = "EliminaADL"; e.Item.Cells[8].Text = "1"; //if (e.Item.Cells[6].Controls[1].GetType().Equals(typeof(DocsPaWebCtrlLibrary.ImageButton))) //{ // if (Session["listInArea"] != null) // { // listInArea = (Hashtable)Session["listInArea"]; // if (listInArea.ContainsKey(this.DocNumber) == false) // listInArea.Add(this.DocNumber, infoDocumento); // Session["listInArea"] = listInArea; // } // else // { // listInArea = new Hashtable(); // listInArea.Add(string.Concat(infoDocumento.numProt, infoDocumento.dataApertura), infoDocumento); // Session["listInArea"] = listInArea; // } //} } } } if (e.CommandName.Equals("EliminaADL")) { this.DataGrid1.SelectedIndex = e.Item.ItemIndex; DocsPaWR.InfoDocumento infoDocumento = this.GetDocumentoSelezionato(); string h = Request.Form["hd1"]; if (this.hd1.Value.Equals("Yes")) { DocsPaWR.SchedaDocumento schedaDocumento = DocumentManager.getDettaglioDocumento(this, infoDocumento.idProfile, infoDocumento.docNumber); DocumentManager.eliminaDaAreaLavoro(this, schedaDocumento.systemId, null); //se ho attiva la nuova ADL devo invertire la funzionalità if (this.RicercaAdl) { string fromPage = Request.QueryString["from"].ToString(); ClientScript.RegisterStartupScript(this.GetType(), "LanciaRic", "top.principale.document.location = 'gestioneRicDoc.aspx?tab=" + fromPage + "&ricADL=1&from=" + fromPage + "';", true); } else { //setto le proprietà video ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).ToolTip = "Inserisci questo documento da 'Area di lavoro'"; ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).ImageUrl = "../images/proto/ins_area.gif"; ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).Attributes.Add("OnClick", "ApriModalDialogNew();"); ((DocsPaWebCtrlLibrary.ImageButton)e.Item.Cells[7].Controls[1]).CommandName = "Area"; } e.Item.Cells[8].Text = "0"; //if (e.Item.Cells[6].Controls[1].GetType().Equals(typeof(DocsPaWebCtrlLibrary.ImageButton))) //{ // if (Session["listInArea"] != null) // { // listInArea = (Hashtable)Session["listInArea"]; // if (!listInArea.ContainsKey(infoDocumento.docNumber)) // listInArea.Add(infoDocumento.docNumber, infoDocumento); // Session["listInArea"] = listInArea; // } // else // { // listInArea = new Hashtable(); // listInArea.Add(string.Concat(infoDocumento.numProt, infoDocumento.dataApertura), infoDocumento); // Session["listInArea"] = listInArea; // } //} } } // visualizza doc in popup if (e.CommandName.Equals("Vis")) { this.DataGrid1.SelectedIndex = e.Item.ItemIndex; //vis unificata DocsPaWR.SchedaDocumento schedaDocumento = DocumentManager.getDettaglioDocumento(this, this.IdProfile, this.DocNumber); DocumentManager.setDocumentoSelezionato(this, schedaDocumento); FileManager.setSelectedFile(this, schedaDocumento.documenti[0], false); ClientScript.RegisterStartupScript(this.GetType(), "lanciaVIs", "loadvisualizzaDoc('" + Session.SessionID + "','" + schedaDocumento.docNumber + "','" + schedaDocumento.systemId + "');", true); } } catch (Exception ex) { ErrorManager.redirectToErrorPage(this, ex); } }
private void DGList_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { ViewState["pk"] = e.Item.Cells[0].Text; this.txt_user.Text = e.Item.Cells[2].Text; txt_user.Enabled = false; }
/// <summary> /// Excecutes <see cref="System.Web.UI.WebControls.DataGrid.OnUpdateCommand"/>, /// then sets <see cref="UpdateAfterCallBack"/> to true. /// </summary> protected override void OnUpdateCommand(System.Web.UI.WebControls.DataGridCommandEventArgs e) { base.OnUpdateCommand(e); this.UpdateAfterCallBack = true; }
protected void dgEdit_StudentRegisterCourse(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { dgStudentRegisterCourse.EditItemIndex = e.Item.ItemIndex; SetupStudentRegisterCourse(); }
private void dgInspections_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { inspect = new clsInspections(); inspect.iOrgId = OrgId; inspect.iId = Convert.ToInt32(e.Item.Cells[0].Text); switch (e.CommandName) { case "Delete": inspect.cAction = "D"; switch (inspect.InspectionDetails()) { case -1: Session["lastpage"] = "admin_inspections.aspx"; Session["error"] = _functions.ErrorMessage(124); Response.Redirect("error.aspx", false); return; case 1: Header.ErrorMessage = _functions.ErrorMessage(154); break; case 2: Header.ErrorMessage = _functions.ErrorMessage(155); break; case 0: dgInspections.EditItemIndex = -1; ShowInspections(); break; default: break; } break; case "Cancel": dgInspections.EditItemIndex = -1; ShowInspections(); break; case "Edit": dgInspections.EditItemIndex = e.Item.ItemIndex; ShowInspections(); break; case "Update": inspect.cAction = "U"; inspect.sInspectionName = ((TextBox)e.Item.FindControl("tbNameEdit")).Text; if (inspect.InspectionDetails() == -1) { Session["lastpage"] = "admin_inspections.aspx"; Session["error"] = _functions.ErrorMessage(124); Response.Redirect("error.aspx", false); return; } dgInspections.EditItemIndex = -1; ShowInspections(); break; default: break; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "admin_inspections.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (inspect != null) { inspect.Dispose(); } } }
private void DataGridTestType_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { int intPriorPaperTestTypeID = 0, intPriorTestTypeID = 0, intPriorTestAmount = 0, intNextPaperTestTypeID = 0, intNextTestTypeID = 0, intNextTestAmount = 0; string strPriorTestTypeTitle = "", strNextTestTypeTitle = ""; double dblPriorTestTypeMark = 0, dblNextTestTypeMark = 0; string strConn = ConfigurationSettings.AppSettings["strConn"]; SqlConnection SqlConn = new SqlConnection(strConn); SqlCommand SqlCmd = null; SqlDataReader ObjDR = null; if (e.CommandName == "MoveUp") { if (e.Item.ItemIndex > 0) { SqlConn.Open(); intPriorPaperTestTypeID = Convert.ToInt32(DataGridTestType.Items[e.Item.ItemIndex - 1].Cells[0].Text); SqlCmd = new SqlCommand("select TestTypeID,TestTypeTitle,TestTypeMark,TestAmount from PaperTestType where PaperTestTypeID='" + intPriorPaperTestTypeID + "'", SqlConn); ObjDR = SqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (ObjDR.Read()) { intPriorTestTypeID = Convert.ToInt32(ObjDR["TestTypeID"].ToString()); strPriorTestTypeTitle = ObjDR["TestTypeTitle"].ToString(); dblPriorTestTypeMark = Convert.ToDouble(ObjDR["TestTypeMark"].ToString()); intPriorTestAmount = Convert.ToInt32(ObjDR["TestAmount"].ToString()); } SqlConn.Close(); SqlConn.Open(); intNextPaperTestTypeID = Convert.ToInt32(DataGridTestType.Items[e.Item.ItemIndex].Cells[0].Text); SqlCmd = new SqlCommand("select TestTypeID,TestTypeTitle,TestTypeMark,TestAmount from PaperTestType where PaperTestTypeID='" + intNextPaperTestTypeID + "'", SqlConn); ObjDR = SqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (ObjDR.Read()) { intNextTestTypeID = Convert.ToInt32(ObjDR["TestTypeID"].ToString()); strNextTestTypeTitle = ObjDR["TestTypeTitle"].ToString(); dblNextTestTypeMark = Convert.ToDouble(ObjDR["TestTypeMark"].ToString()); intNextTestAmount = Convert.ToInt32(ObjDR["TestAmount"].ToString()); } SqlConn.Close(); SqlConn.Open(); SqlCmd = new SqlCommand("Update PaperTestType set TestTypeID='" + intNextTestTypeID + "',TestTypeTitle='" + strNextTestTypeTitle + "',TestTypeMark='" + dblNextTestTypeMark + "',TestAmount='" + intNextTestAmount + "' where PaperTestTypeID='" + intPriorPaperTestTypeID + "'", SqlConn); SqlCmd.ExecuteNonQuery(); SqlCmd = new SqlCommand("Update PaperTestType set TestTypeID='" + intPriorTestTypeID + "',TestTypeTitle='" + strPriorTestTypeTitle + "',TestTypeMark='" + dblPriorTestTypeMark + "',TestAmount='" + intPriorTestAmount + "' where PaperTestTypeID='" + intNextPaperTestTypeID + "'", SqlConn); SqlCmd.ExecuteNonQuery(); SqlConn.Close(); } } if (e.CommandName == "MoveDown") { if (e.Item.ItemIndex < DataGridTestType.Items.Count - 1) { SqlConn.Open(); intPriorPaperTestTypeID = Convert.ToInt32(DataGridTestType.Items[e.Item.ItemIndex].Cells[0].Text); SqlCmd = new SqlCommand("select TestTypeID,TestTypeTitle,TestTypeMark,TestAmount from PaperTestType where PaperTestTypeID='" + intPriorPaperTestTypeID + "'", SqlConn); ObjDR = SqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (ObjDR.Read()) { intPriorTestTypeID = Convert.ToInt32(ObjDR["TestTypeID"].ToString()); strPriorTestTypeTitle = ObjDR["TestTypeTitle"].ToString(); dblPriorTestTypeMark = Convert.ToDouble(ObjDR["TestTypeMark"].ToString()); intPriorTestAmount = Convert.ToInt32(ObjDR["TestAmount"].ToString()); } SqlConn.Close(); SqlConn.Open(); intNextPaperTestTypeID = Convert.ToInt32(DataGridTestType.Items[e.Item.ItemIndex + 1].Cells[0].Text); SqlCmd = new SqlCommand("select TestTypeID,TestTypeTitle,TestTypeMark,TestAmount from PaperTestType where PaperTestTypeID='" + intNextPaperTestTypeID + "'", SqlConn); ObjDR = SqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (ObjDR.Read()) { intNextTestTypeID = Convert.ToInt32(ObjDR["TestTypeID"].ToString()); strNextTestTypeTitle = ObjDR["TestTypeTitle"].ToString(); dblNextTestTypeMark = Convert.ToDouble(ObjDR["TestTypeMark"].ToString()); intNextTestAmount = Convert.ToInt32(ObjDR["TestAmount"].ToString()); } SqlConn.Close(); SqlConn.Open(); SqlCmd = new SqlCommand("Update PaperTestType set TestTypeID='" + intNextTestTypeID + "',TestTypeTitle='" + strNextTestTypeTitle + "',TestTypeMark='" + dblNextTestTypeMark + "',TestAmount='" + intNextTestAmount + "' where PaperTestTypeID='" + intPriorPaperTestTypeID + "'", SqlConn); SqlCmd.ExecuteNonQuery(); SqlCmd = new SqlCommand("Update PaperTestType set TestTypeID='" + intPriorTestTypeID + "',TestTypeTitle='" + strPriorTestTypeTitle + "',TestTypeMark='" + dblPriorTestTypeMark + "',TestAmount='" + intPriorTestAmount + "' where PaperTestTypeID='" + intNextPaperTestTypeID + "'", SqlConn); SqlCmd.ExecuteNonQuery(); SqlConn.Close(); } } SqlConn.Dispose(); ShowPaperTestType(); }
protected void dgUpdate_StudentRegisterCourse(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { }