void Save_new() { //id,yydh,qymc,jbxs,hyrx,dfjf,is_top,is_select int judge_save = 3;//3保存,其余不保存 judge_save = common_file.common_app.get_judge_repeat("YH_Roles", "R_lsbh", "编号已经存在了", tB_Rlsbh.Text, judge_add_edit, YH_Roles_id); if (judge_save == 3) { judge_save = common_file.common_app.get_judge_repeat("YH_Roles", "R_RolesName", "角色名称已经存在了", tB_RolesName.Text, judge_add_edit, YH_Roles_id); } if (judge_save == 3) { if (judge_add_edit == common_file.common_app.get_add) { string bz_value = tB_bz.Text.Trim().Replace("'", "-"); string RolesName_value = this.tB_RolesName.Text; int ts_value = int.Parse(this.tB_ts.Text); string Rlsbh_value = this.tB_Rlsbh.Text; bool f = common_file.common_roles.YH_Roles_Add(common_file.common_app.yydh, common_file.common_app.qymc, Rlsbh_value, RolesName_value, bz_value, ts_value); if (f) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "保存成功!"); parent_form.refresh_app(); tB_Rlsbh.Text = ""; tB_Rlsbh.Focus(); tB_RolesName.Text = ""; tB_bz.Text = ""; } else { common_file.common_app.Message_box_show(common_file.common_app.message_title, "操作失败!"); } } else if (judge_add_edit == common_file.common_app.get_edit) { string url = common_file.common_app.service_url + "Yhgl/Yhgl_app.asmx"; object[] args = new object[9]; args[0] = YH_Roles_id; args[1] = common_file.common_app.yydh; args[2] = common_file.common_app.qymc; args[3] = tB_Rlsbh.Text.Trim().Replace("'", "-"); args[4] = tB_RolesName.Text.Trim().Replace("'", "-"); args[5] = tB_bz.Text.Trim().Replace("'", "-"); args[6] = tB_ts.Text.Trim().Replace("'", "-"); args[7] = judge_add_edit; args[8] = common_file.common_app.xxzs; Hotel_app.Server.Yhgl.YH_Roles YH_Roles_services = new Hotel_app.Server.Yhgl.YH_Roles(); string result = YH_Roles_services.YHRoles_add_edit(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString(), args[4].ToString(), args[5].ToString(), args[6].ToString(), args[7].ToString(), args[8].ToString()); //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "YHRoles_add_edit", args); if (result == common_file.common_app.get_suc) { string p_lshb_value = tB_Rlsbh.Text.Trim(); string r_RoleN_value = tB_RolesName.Text.Trim(); //把所有权限写到角色表里p_value=0; common_file.common_app.Message_box_show(common_file.common_app.message_title, "保存成功!"); parent_form.refresh_app(); this.Close(); } else { common_file.common_app.Message_box_show(common_file.common_app.message_title, "操作失败!"); } } } }
private void b_delete_Click(object sender, EventArgs e) { common_file.common_app.get_czsj(); if (DS_YH_Roles != null && DS_YH_Roles.Tables[0].Rows.Count > 0) { if (common_file.common_app.message_box_show_select(common_file.common_app.message_title, "是否要删除所选中的记录!") == true) { int j = 0; string s = ""; for (int i = 0; i < dg_count; i++) { common_file.common_app.get_czsj(); DataGridViewDataErrorContexts ss = new DataGridViewDataErrorContexts(); if (this.dg_yhroles.Rows[i].Cells[0].GetEditedFormattedValue(i, ss) != null && Convert.ToBoolean(this.dg_yhroles.Rows[i].Cells[0].GetEditedFormattedValue(i, ss)) == true) { //j = Convert.ToInt32(dg_yhroles.Rows[i].Index.ToString()); DataRowView dgr = dg_yhroles.Rows[i].DataBoundItem as DataRowView; j = DS_YH_Roles.Tables[0].Rows.IndexOf(dgr.Row); if (DS_YH_Roles.Tables[0].Rows[j]["id"].ToString() != "") { string url = common_file.common_app.service_url + "Yhgl/Yhgl_app.asmx"; string[] args = new string[9]; args[0] = DS_YH_Roles.Tables[0].Rows[j]["id"].ToString(); args[1] = common_file.common_app.yydh; args[2] = common_file.common_app.qymc; args[3] = ""; args[4] = ""; args[5] = ""; args[6] = ""; args[7] = common_file.common_app.get_delete; args[8] = common_file.common_app.xxzs; Hotel_app.Server.Yhgl.YH_Roles YH_Roles_services = new Hotel_app.Server.Yhgl.YH_Roles(); string result = YH_Roles_services.YHRoles_add_edit(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString(), args[4].ToString(), args[5].ToString(), args[6].ToString(), args[7].ToString(), args[8].ToString()); // object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "YHRoles_add_edit", args); if (result == common_file.common_app.get_suc && (s == common_file.common_app.get_suc || s == "")) { s = common_file.common_app.get_suc; } else { s = common_file.common_app.get_failure; } } //common_file.common_app.Message_box_show(common_file.common_app.message_title, dataGridViewSummary1.Rows[i].Index.ToString()); } } if (s == common_file.common_app.get_suc) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除成功!"); } else if (s == common_file.common_app.get_failure) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除不成功!"); } refresh_app(); } } Cursor.Current = Cursors.Default; }