protected void btn_rePush_Click(object sender, EventArgs e) { try { //是否存在非异常单 CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1"); string sqlCmd = string.Empty; foreach (GridRow row in Grid1.Rows) { int rowIndex = row.RowIndex; bool isSel = field1.GetCheckedState(rowIndex); if (isSel) { string apiState = row.Values[7].ToString();//API状态 int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); if (apiState != "异常") { continue; } else { sqlCmd = "update sfyordertab set isnew='0' where SOId='" + rowID + "'"; SqlSel_Pro.ExeSql(sqlCmd); } } } Alert.Show("操作成功!"); reBound(); } catch (Exception ex) { Alert.ShowInTop(ex.Message); } }
protected void Button1_Click(object sender, EventArgs e) { CheckBoxField field2 = (CheckBoxField)Grid1.FindColumn("CheckBoxField2"); StringBuilder sb = new StringBuilder(); int selectedCount = Grid1.SelectedRowIndexArray.Length; if (selectedCount > 0) { sb.AppendFormat("共选中了 {0} 行:", selectedCount); sb.Append("<ol class=\"result\">"); for (int i = 0; i < selectedCount; i++) { int rowIndex = Grid1.SelectedRowIndexArray[i]; sb.Append("<li><ul>"); sb.AppendFormat("<li>行号:{0}</li>", rowIndex + 1); sb.AppendFormat("<li>是否在校(自动会发):{0}</li>", field2.GetCheckedState(rowIndex)); sb.Append("</ul></li>"); } sb.Append("</ol>"); } else { sb.Append("<strong>没有选中任何一行!</strong>"); } labResult.Text = sb.ToString(); }
protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "UDISABLED") { //上架操作权限 if (!VerifyPurview(",SU-EDIT,")) { Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE); return; } CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex); bool checkState = checkField.GetCheckedState(e.RowIndex); int result = new UserBLL().SetDisabled(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), checkState); string tipText = checkState ? "禁用" : "启用"; if (result > 0) { Alert.ShowInParent(tipText + "成功!"); BindData(); } else { Alert.ShowInParent(tipText + "失败!"); } } }
/// <summary> /// Grid1行点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) { string rowID = Grid1.DataKeys[e.RowIndex][0].ToString(); //string parentId = Grid1.DataKeys[e.RowIndex][1].ToString(); if (e.CommandName == "IsSelected") { CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected"); if (checkField.GetCheckedState(e.RowIndex)) { if (!list.Contains(rowID)) { list.Add(rowID); } //if (!parentIds.Contains(parentId + "," + rowID)) //{ // parentIds.Add(parentId + "," + rowID); //} } else { if (list.Contains(rowID)) { list.Remove(rowID); } //if (parentIds.Contains(parentId + "," + rowID)) //{ // parentIds.Remove(parentId + "," + rowID); //} } } }
protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "UDISABLED") { //编辑权限 if (!VerifyPurview(",SM-SET,")) { Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE); return; } CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex); bool checkState = checkField.GetCheckedState(e.RowIndex); int result = new PCBLL().SetDisabled(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), checkState); string tipText = (checkState ? "禁用" : "启用"); if (result > 0) { Alert.ShowInParent(tipText + "成功!"); BindData(); } else { Alert.ShowInParent(tipText + "失败!"); } } if (e.CommandName == "Edit") { txtID.Text = Grid1.DataKeys[e.RowIndex][0].ToString(); txtName.Text = HttpUtility.HtmlDecode(Grid1.DataKeys[e.RowIndex][1].ToString()); txtCode.Text = HttpUtility.HtmlDecode(Grid1.DataKeys[e.RowIndex][2].ToString()).Split('-')[1]; chkDisabled.Checked = Convert.ToBoolean(Grid1.DataKeys[e.RowIndex][3].ToString()); } }
protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "CheckBox1") { CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex); bool checkState = checkField.GetCheckedState(e.RowIndex); Alert.ShowInTop(String.Format("你点击了第 {0} 行,第 {1} 列,选中状态:{2}", e.RowIndex + 1, e.ColumnIndex + 1, checkState)); } else if (e.CommandName == "Action1" || e.CommandName == "Action2") { Alert.ShowInTop(String.Format("你点击了第 {0} 行,第 {1} 列,行命令是 {2}", e.RowIndex + 1, e.ColumnIndex + 1, e.CommandName)); } }
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName == "Delete") { int rowID = e.RowIndex; string memberId = Grid1.DataKeys[rowID][0].ToString(); string sqlCmd = "delete from OA_Sys_ProjMember where id='" + memberId + "'"; SqlSel.ExeSql(sqlCmd); ProjMemberBind(Grid2.DataKeys[Grid2.SelectedRowIndex][0].ToString()); Alert.ShowInTop("已删除!"); } if (e.CommandName == "isManager") { int rowID = e.RowIndex; CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex); bool checkState = checkField.GetCheckedState(e.RowIndex); string memberId = Grid1.DataKeys[rowID][0].ToString(); string memberName = Grid1.Rows[rowID].Values[0].ToString(); if (checkState == true) { string sqlCmd = "update OA_Sys_ProjMember set isManager='1' where id='" + memberId + "'"; SqlSel.ExeSql(sqlCmd); Alert.ShowInTop(string.Format("{0} 已设置为项目负责人!", memberName)); } else { string sqlCmd = "update OA_Sys_ProjMember set isManager='0' where id='" + memberId + "'"; SqlSel.ExeSql(sqlCmd); Alert.ShowInTop(string.Format("已取消 {0} 项目负责人权限!", memberName)); } ProjMemberBind(Grid2.DataKeys[Grid2.SelectedRowIndex][0].ToString()); } } catch (Exception ex) { Alert.ShowInTop(ex.Message); } }
/// <summary> /// Grid1行点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) { string rowID = Grid1.DataKeys[e.RowIndex][0].ToString(); if (e.CommandName == "IsSelected") { CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected"); if (checkField.GetCheckedState(e.RowIndex)) { if (!ItemSelectedList.Contains(rowID)) { ItemSelectedList.Add(rowID); } } else { if (ItemSelectedList.Contains(rowID)) { ItemSelectedList.Remove(rowID); } } } }
//判断grid选中行 public List <int> GridCount(Grid grid, CheckBoxField checkbox) { int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(grid.RecordCount / grid.PageSize)); List <int> selections = new List <int>(); if (grid.PageIndex == Pages) { m = (grid.RecordCount - grid.PageSize * grid.PageIndex); } else { m = grid.PageSize; } for (int i = 0; i < m; i++) { if (checkbox.GetCheckedState(i)) { selections.Add(i); } } return(selections); }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); List <ServiceComponentList> lServiceComponentList = new List <ServiceComponentList>(); ServiceBL _ObjServiceBL = new ServiceBL(); CheckBoxField field1 = (CheckBoxField)grdData.FindColumn("CheckBoxField2"); for (int i = 0; i < grdData.Rows.Count; i++) { servicecomponentDto objServiceComponentDto = new servicecomponentDto(); bool ChecAdicional = field1.GetCheckedState(i); var Flag = grdData.Rows[i].Values[4].ToString(); if (ChecAdicional) { objServiceComponentDto.v_ServiceId = Session["SerId"].ToString(); objServiceComponentDto.i_ExternalInternalId = 1;//interno objServiceComponentDto.i_ServiceComponentTypeId = 1; objServiceComponentDto.i_IsVisibleId = 1; objServiceComponentDto.i_IsInheritedId = 0; objServiceComponentDto.d_StartDate = null; objServiceComponentDto.d_EndDate = null; objServiceComponentDto.i_index = 1; objServiceComponentDto.r_Price = 10; objServiceComponentDto.v_ComponentId = grdData.Rows[i].Values[3]; objServiceComponentDto.i_IsInvoicedId = 0; objServiceComponentDto.i_ServiceComponentStatusId = 1; // (int)Common.ServiceStatus.PorIniciar; objServiceComponentDto.i_QueueStatusId = 1; // (int)Common.QueueStatusId.LIBRE; objServiceComponentDto.i_Iscalling = 0; // (int)Common.Flag_Call.NoseLlamo; objServiceComponentDto.i_IsManuallyAddedId = 0; // (int)Common.SiNo.NO; objServiceComponentDto.i_IsRequiredId = 1; // (int)Common.SiNo.SI; if (Flag == "0") { _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } else if (Flag == "1") { _ObjServiceBL.UpdateAdditionalExam(ref objOperationResult, grdData.Rows[i].Values[5].ToString(), 1, ((ClientSession)Session["objClientSession"]).GetAsList()); } } else if (ChecAdicional == false) { //var Lista_OLD = (List<Categoria>)Session["lComponentes_OLD"]; //var Flag = grdData.Rows[i].Values[4].ToString(); if (Flag == "1") { _ObjServiceBL.UpdateAdditionalExam(ref objOperationResult, grdData.Rows[i].Values[5].ToString(), 0, ((ClientSession)Session["objClientSession"]).GetAsList()); } //Lista_OLD.Find(p => p.v_ComponentId == grdData.Rows[i].Values[3].ToString()); } } //Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { // Cerrar página actual y hacer postback en el padre para actualizar PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else // Operación con error { Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage); // Se queda en el formulario. } }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { string Mode = Request.QueryString["Mode"].ToString(); OperationResult objOperationResult = new OperationResult(); _protocolcomponentListDTO = new List <protocolcomponentDto>(); _protocolDTO = new protocolDto(); var id = cbOrganization.SelectedValue.ToString().Split('|'); var id1 = cbOrganizationInvoice.SelectedValue.ToString().Split('|'); var id2 = cbIntermediaryOrganization.SelectedValue.ToString().Split('|'); _protocolDTO.v_Name = txtProtocolName.Text; _protocolDTO.v_EmployerOrganizationId = id[0]; _protocolDTO.v_EmployerLocationId = id[1]; _protocolDTO.i_EsoTypeId = int.Parse(cbEsoType.SelectedValue.ToString()); _protocolDTO.v_GroupOccupationId = cbGeso.SelectedValue.ToString(); _protocolDTO.v_CustomerOrganizationId = id1[0]; _protocolDTO.v_CustomerLocationId = id1[1]; _protocolDTO.v_WorkingOrganizationId = id2[0]; _protocolDTO.v_WorkingLocationId = cbIntermediaryOrganization.SelectedValue.ToString() != "-1" ? id2[1] : "-1"; _protocolDTO.i_MasterServiceId = int.Parse(cbService.SelectedValue.ToString()); _protocolDTO.v_CostCenter = txtCostCenter.Text; _protocolDTO.i_MasterServiceTypeId = int.Parse(cbServiceType.SelectedValue.ToString()); _protocolDTO.i_HasVigency = 0; _protocolDTO.i_ValidInDays = 0; _protocolDTO.i_IsActive = 1; _protocolDTO.v_NombreVendedor = ""; if (Mode == "New") { if (IsExistsProtocolName()) { Alert.Show("Este protocolo ya existe"); return; } CheckBoxField field1 = (CheckBoxField)grdData.FindColumn("CheckBoxField2"); for (int i = 0; i < grdData.Rows.Count; i++) { if (field1.GetCheckedState(i) == true) { _protocolDTO.v_ProtocolId = null; GridRow row = grdData.Rows[i]; System.Web.UI.WebControls.TextBox txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("r_Price"); protocolcomponentDto protocolComponent = new protocolcomponentDto(); protocolComponent.v_ComponentId = grdData.Rows[i].Values[5]; protocolComponent.r_Price = float.Parse(txtPrice.Text.ToString());// float.Parse(grdData.Rows[i].Values[4].ToString()); //protocolComponent.i_OperatorId = -1; //protocolComponent.i_Age = 0; //protocolComponent.i_GenderId = 3; //protocolComponent.i_IsAdditional = 0; //protocolComponent.i_IsConditionalId =0; System.Web.UI.WebControls.TextBox txtEdad = (System.Web.UI.WebControls.TextBox)row.FindControl("i_Age"); CheckBoxField fieldAdicional = (CheckBoxField)grdData.FindColumn("CheckBoxField3"); bool ChecAdicional = fieldAdicional.GetCheckedState(i); CheckBoxField fieldCondicional = (CheckBoxField)grdData.FindColumn("CheckBoxField4"); bool ChecCondicional = fieldCondicional.GetCheckedState(i); protocolComponent.i_Age = int.Parse(txtEdad.Text.ToString()); protocolComponent.i_IsAdditional = ChecAdicional == true ? 1 : 0; protocolComponent.i_IsConditionalId = ChecCondicional == true ? 1 : 0; System.Web.UI.WebControls.DropDownList ddlOperador = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlOperador"); System.Web.UI.WebControls.DropDownList ddlGender = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlGender"); protocolComponent.i_GenderId = int.Parse(ddlGender.SelectedValue.ToString()); protocolComponent.i_OperatorId = int.Parse(ddlOperador.SelectedValue.ToString()); protocolComponent.i_IsConditionalIMC = 0; protocolComponent.r_Imc = 0; _protocolcomponentListDTO.Add(protocolComponent); } } _protocolBL.AddProtocol(ref objOperationResult, _protocolDTO, _protocolcomponentListDTO, ((ClientSession)Session["objClientSession"]).GetAsList()); } else if (Mode == "Edit") { _protocolDTO.v_ProtocolId = Session["ProtocolId"].ToString(); //Eliminar Fisicamente registros de protocolcomponent _protocolBL.EliminarProtocolComponentByProtocolId(ref objOperationResult, Session["ProtocolId"].ToString()); //Grabar de nuevo la entidad CheckBoxField field1 = (CheckBoxField)grdData.FindColumn("CheckBoxField2"); for (int i = 0; i < grdData.Rows.Count; i++) { if (field1.GetCheckedState(i) == true) { protocolcomponentDto protocolComponent = new protocolcomponentDto(); GridRow row = grdData.Rows[i]; System.Web.UI.WebControls.TextBox txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("r_Price"); System.Web.UI.WebControls.TextBox txtEdad = (System.Web.UI.WebControls.TextBox)row.FindControl("i_Age"); CheckBoxField fieldAdicional = (CheckBoxField)grdData.FindColumn("CheckBoxField3"); bool ChecAdicional = fieldAdicional.GetCheckedState(i); CheckBoxField fieldCondicional = (CheckBoxField)grdData.FindColumn("CheckBoxField4"); bool ChecCondicional = fieldCondicional.GetCheckedState(i); System.Web.UI.WebControls.DropDownList ddlOperador = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlOperador"); System.Web.UI.WebControls.DropDownList ddlGender = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlGender"); protocolComponent.v_ComponentId = grdData.Rows[i].Values[5]; protocolComponent.r_Price = float.Parse(txtPrice.Text.ToString()); protocolComponent.i_Age = int.Parse(txtEdad.Text.ToString()); protocolComponent.i_IsAdditional = ChecAdicional == true ? 1:0; protocolComponent.i_IsConditionalId = ChecCondicional == true ? 1 : 0; protocolComponent.i_GenderId = int.Parse(ddlGender.SelectedValue.ToString()); protocolComponent.i_OperatorId = int.Parse(ddlOperador.SelectedValue.ToString()); protocolComponent.i_IsConditionalIMC = 0; protocolComponent.r_Imc = 0; _protocolcomponentListDTO.Add(protocolComponent); } } _protocolBL.AddProtocol(ref objOperationResult, _protocolDTO, _protocolcomponentListDTO, ((ClientSession)Session["objClientSession"]).GetAsList()); } //Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { // Cerrar página actual y hacer postback en el padre para actualizar PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else // Operación con error { Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage); // Se queda en el formulario. } }