void Save_new() { //id, yydh, qymc, yhbh, yhxm, yhmm, R_lsbh, R_RolesName, add_edit_delete, xxzs int judge_save = 3;//3保存,其余不保存 string PassWord_value = common_file.common_yhuser.GetUser_mm("123456"); judge_save = common_file.common_app.get_judge_repeat("YH_user", "yhbh", "用户编号已经存在了", tB_yhbh.Text, judge_add_edit, YH_id); if (judge_save == 3) { judge_save = common_file.common_app.get_judge_repeat("YH_user", "yhxm", "用户姓名已经存在了", tB_yhxm.Text, judge_add_edit, YH_id); } if (judge_save == 3) { string strRName = this.cB_Role.Text; string strYhbm = this.cB_bm.Text;//用户部门 string url = common_file.common_app.service_url + "Yhgl/Yhgl_app.asmx"; object[] args = new object[11]; args[0] = YH_id; args[1] = common_file.common_app.yydh; args[2] = common_file.common_app.qymc; args[3] = tB_yhbh.Text.Trim().Replace("'", "-"); args[4] = tB_yhxm.Text.Trim().Replace("'", "-"); args[5] = PassWord_value; args[6] = GetR_lsbh(strRName); args[7] = strRName; args[8] = strYhbm; args[9] = judge_add_edit; args[10] = common_file.common_app.xxzs; Hotel_app.Server.Yhgl.YH_User yh_user_services = new Hotel_app.Server.Yhgl.YH_User(); string result = yh_user_services.YHUser_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(), args[9].ToString(), args[10].ToString()); //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "YHUser_add_edit", args); if (result == common_file.common_app.get_suc) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "保存成功!"); if (judge_add_edit == common_file.common_app.get_add) { parent_form.refresh_app(); tB_yhbh.Text = ""; tB_yhbh.Focus(); tB_yhxm.Text = ""; } else if (judge_add_edit == common_file.common_app.get_edit) { 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_User != null && DS_YH_User.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_yhgl.Rows[i].Cells[0].GetEditedFormattedValue(i, ss) != null && Convert.ToBoolean(this.dg_yhgl.Rows[i].Cells[0].GetEditedFormattedValue(i, ss)) == true) { //j = Convert.ToInt32(dg_yhgl.Rows[i].Index.ToString()); DataRowView dgr = dg_yhgl.Rows[i].DataBoundItem as DataRowView; j = DS_YH_User.Tables[0].Rows.IndexOf(dgr.Row); if (DS_YH_User.Tables[0].Rows[j]["id"].ToString() != "") {//id, yydh, qymc, yhbh, yhxm, yhmm, R_lsbh, R_RolesName,yhbm,add_edit_delete, xxzs string url = common_file.common_app.service_url + "Yhgl/Yhgl_app.asmx"; object[] args = new object[11]; args[0] = DS_YH_User.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] = ""; args[8] = ""; args[9] = common_file.common_app.get_delete; args[10] = common_file.common_app.xxzs; Hotel_app.Server.Yhgl.YH_User yh_user_services = new Hotel_app.Server.Yhgl.YH_User(); string result = yh_user_services.YHUser_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(), args[9].ToString(), args[10].ToString()); //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "YHUser_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; }