private void b_save_Click(object sender, EventArgs e) { common_file.common_app.get_czsj(); if (tB_classname.Text == "") { common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,项目类型不能为空"); tB_classname.Focus(); } else if (tB_title.Text == "") { common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,项目名称不能为空"); tB_title.Focus(); } else if (tB_dfsl.Text == "") { common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,兑换数量不能为空"); tB_dfsl.Focus(); } else if ((Maticsoft.Common.PageValidate.IsDecimal(tB_dfsl.Text.Trim()) || Maticsoft.Common.PageValidate.IsNumber(tB_dfsl.Text.Trim())) == false) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,所输入的数量不是有效数值!"); tB_dfsl.Focus(); } else { M_Hhygl = B_Hhygl.GetModelList(" id>=0 " + common_file.common_app.yydh_select + " and hykh='" + hykh + "'")[0]; decimal strdfjf = Convert.ToDecimal(tB_dfjf.Text.Trim()); if (M_Hhygl.hyjf < strdfjf) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,您的积分不够。"); tB_classname.Focus(); } else { if (save_new() == common_file.common_app.get_suc) { decimal strhyzjf = M_Hhygl.hyjf - strdfjf;//会员兑换完后的积分 string strSql = " update Hhygl set hyjf=" + strhyzjf + ",shxg=1,xgsj=getdate() where hykh='" + hykh + "'"; int isok = DbHelperSQL.ExecuteSql(strSql); if (isok > 0) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "恭喜您," + tB_title.Text + "兑换成功。"); common_file.common_hy.Hhygl_browse_new.refresh_app(); common_file.common_hy.Hhygl_browse_new.open_record(); tB_title.Text = ""; tB_dfsl.Text = "1.0"; tB_dfjf.Text = ""; tB_classname.Text = ""; } } else { common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,兑换失败。"); } } } Cursor.Current = Cursors.Default; }
private void Save_hy() { common_file.common_app.get_czsj(); string stryydh = common_file.common_app.yydh; string strqymc = common_file.common_app.qymc; string url = common_file.common_app.service_url + "Hhygl/Hhygl_app.asmx"; //状态为空的时候(为新增记录),生成临时编号 if (add_edit == common_file.common_app.get_add && tB_hykh_bz.Text.Trim() != "") { hykh = common_file.common_ddbh.ddbh("hy", "hydate", "hycounter", 6); } if (add_edit == common_file.common_app.get_edit && tB_hykh_bz.Text.Trim() != "") { hykh = M_Hhygl.hykh; hymm = M_Hhygl.hymm;//读取会员密码 stryydh = M_Hhygl.yydh; strqymc = M_Hhygl.qymc; } string[] args = new string[35]; args[0] = Hhygl_id.ToString(); args[1] = stryydh; args[2] = strqymc; args[3] = hykh; args[4] = cB_hyrx.Text.Trim().Replace("'", "-"); args[5] = tB_hykh_bz.Text.Trim().Replace("'", "-"); args[6] = tB_krxm.Text.Trim().Replace("'", "-"); args[7] = tB_krgj.Text.Trim().Replace("'", "-"); args[8] = tB_krmz.Text.Trim().Replace("'", "-"); args[9] = tB_yxzj.Text.Trim().Replace("'", "-"); args[10] = tB_zjhm.Text.Trim().Replace("'", "-"); args[11] = dT_krsr.Text.Trim().Replace("'", "-"); args[12] = cB_krxb.Text.Trim().Replace("'", "-"); args[13] = tB_krdh.Text.Trim().Replace("'", "-"); args[14] = tB_krsj.Text.Trim().Replace("'", "-"); args[15] = tB_krEmail.Text.Trim().Replace("'", "-"); args[16] = tB_krdz.Text.Trim().Replace("'", "-"); args[17] = tB_krzy.Text.Trim().Replace("'", "-"); args[18] = tB_krdw.Text.Trim().Replace("'", "-"); args[19] = tB_qzrx.Text.Trim().Replace("'", "-"); args[20] = tB_qzhm.Text.Trim().Replace("'", "-"); args[21] = dT_zjyxq.Text.Trim().Replace("'", "-"); args[22] = dT_tlyxq.Text.Trim().Replace("'", "-"); args[23] = dT_tjrq.Text.Trim().Replace("'", "-"); args[24] = tB_lzka.Text.Trim().Replace("'", "-"); args[25] = tB_bz.Text.Trim().Replace("'", "-"); args[26] = tB_hyjf.Text.Trim().Replace("'", "-"); if (add_edit == common_file.common_app.get_add) { args[27] = "false"; args[28] = common_file.common_app.cssj; } else { args[27] = "true"; args[28] = DateTime.Now.ToString(); //DateTime.Now.ToShortDateString(); } args[29] = p_hykh; //主卡 args[30] = hymm; //密码 args[31] = tB_xsy.Text.Trim().Replace("'", "-"); args[32] = common_file.common_app.czy; args[33] = add_edit; args[34] = common_file.common_app.xxzs; string result = common_file_server.common_app.get_failure; Hotel_app.Server.Hhygl.Hhygl_add_edit Hhygl_add_edit_services = new Hotel_app.Server.Hhygl.Hhygl_add_edit(); try { result = Hhygl_add_edit_services.Hhygl_add_edit_delete_app(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(), args[11].ToString(), args[12].ToString(), args[13].ToString(), args[14].ToString(), args[15].ToString(), args[16].ToString(), args[17].ToString(), args[18].ToString(), args[19].ToString(), args[20].ToString(), args[21].ToString(), args[22].ToString(), args[23].ToString(), args[24].ToString(), args[25].ToString(), args[26].ToString(), args[27].ToString(), args[28].ToString(), args[29].ToString(), args[30].ToString(), args[31].ToString(), args[32].ToString(), args[33].ToString(), args[34].ToString()); } catch (Exception ee) { MessageBox.Show(ee.ToString()); } //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Hhygl_add_edit_delete_app", args); if (result != null && result == common_file.common_app.get_suc) { if (add_edit == common_file.common_app.get_add) { common_file.common_czjl.add_czjl(stryydh, strqymc, common_file.common_app.czy, "新增会员成功", "" + tB_hykh_bz.Text + "", "", DateTime.Now); String s_ma_rem = "新增会员成功!"; DataSet ds_temp_09 = B_Common.GetList("select * from Qcounter", " 1=1 "); if (ds_temp_09 != null && ds_temp_09.Tables[0].Rows.Count > 0) { if (bool.Parse(ds_temp_09.Tables[0].Rows[0]["Hhygl_qyqr"].ToString()) == true) { s_ma_rem = s_ma_rem + "目前会员还没验证,还不能正常使用,请及时发送验证码给客人进行验证!"; } } common_file.common_app.Message_box_show(common_file.common_app.message_title, s_ma_rem); add_edit = common_file.common_app.get_edit;//保存完后修改成修改状态 //并立即加载成当前的新增的会员信息 List <Model.Hhygl> list_current = B_Hhygl.GetModelList(" id>=0 and hykh_bz='" + tB_hykh_bz.Text.Trim() + "'"); if (list_current != null && list_current.Count > 0) { M_Hhygl = list_current[0]; Hhygl_id = M_Hhygl.id.ToString(); } common_file.common_hy.Hhygl_browse_new.refresh_app(); return; //clear_main_infor();//清空数据,如果要继续新增就要启用这个,注释掉状态的修改 } if (add_edit == common_file.common_app.get_edit) { common_file.common_czjl.add_czjl(stryydh, strqymc, common_file.common_app.czy, "修改会员成功", "" + tB_hykh_bz.Text + "", "", DateTime.Now); common_file.common_app.Message_box_show(common_file.common_app.message_title, "修改成功."); if (common_file.common_hy.Hhygl_browse_new != null) { common_file.common_hy.Hhygl_browse_new.refresh_app(); } } common_file.common_hy.Hhygl_browse_new.refresh_app(); return; } else { common_file.common_app.Message_box_show(common_file.common_app.message_title, "操作失败."); } }