示例#1
0
        private void b_delete_Click(object sender, EventArgs e)
        {
            common_file.common_app.get_czsj();
            if (DS_Xkrmz != null && DS_Xkrmz.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_krmz.Rows[i].Cells[0].GetEditedFormattedValue(i, ss) != null && Convert.ToBoolean(this.dg_krmz.Rows[i].Cells[0].GetEditedFormattedValue(i, ss)) == true)
                        {
                            j = Convert.ToInt32(dg_krmz.Rows[i].Index.ToString());

                            DataRowView dgr = dg_krmz.Rows[i].DataBoundItem as DataRowView;
                            j = DS_Xkrmz.Tables[0].Rows.IndexOf(dgr.Row);
                            if (DS_Xkrmz.Tables[0].Rows[j]["id"].ToString() != "")
                            {
                                //string id, string yydh, string qymc, string krmz, string zjm, string add_edit_delete, string xxzs)
                                string   url  = common_file.common_app.service_url + "Xxtsz/Xxtsz_app.asmx";
                                object[] args = new object[7];
                                args[0] = DS_Xkrmz.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] = common_file.common_app.get_delete;
                                args[6] = common_file.common_app.xxzs;

                                Hotel_app.Server.Xxtsz.Xkrmz Xkrmz_services = new Hotel_app.Server.Xxtsz.Xkrmz();
                                string result = Xkrmz_services.Xkrmz_add_edit(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString(), args[4].ToString(), args[5].ToString(), args[6].ToString());
                                // object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Xkrmz_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;
                                }
                            }
                        }
                    }
                    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;
        }
示例#2
0
        private void b_save_Click(object sender, EventArgs e)
        {
            common_file.common_app.get_czsj();
            //Cursor.Current = Cursors.WaitCursor;
            if (tB_krmz.Text.Trim() == "")
            {
                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,客人民族不能为空!");
                tB_krmz.Focus();
            }
            else
            if (tB_zjm.Text.Trim() == "")
            {
                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,助记码不能为空!");
                tB_zjm.Focus();
            }
            else
            {
                int judge_save = 3;    //3保存,其余不保存
                judge_save = common_file.common_app.get_judge_repeat("Xkrmz", "krmz", "客人民族已经存在了", tB_krmz.Text, judge_add_edit, Xkrmz_id);
                if (judge_save == 3)
                {
                    string   url  = common_file.common_app.service_url + "Xxtsz/Xxtsz_app.asmx";
                    string[] args = new string[7];
                    args[0] = Xkrmz_id;
                    args[1] = common_file.common_app.yydh;
                    args[2] = common_file.common_app.qymc;
                    args[3] = tB_krmz.Text.Trim().Replace("'", "-");
                    args[4] = tB_zjm.Text.Trim().Replace("'", "-");
                    args[5] = judge_add_edit;
                    args[6] = common_file.common_app.xxzs;

                    Hotel_app.Server.Xxtsz.Xkrmz Xkrmz_services = new Hotel_app.Server.Xxtsz.Xkrmz();
                    string result = Xkrmz_services.Xkrmz_add_edit(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString(), args[4].ToString(), args[5].ToString(), args[6].ToString());
                    //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Xkrmz_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_krmz.Text = ""; tB_krmz.Focus(); tB_zjm.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, "操作失败!");
                    }
                }
            }

            Cursor.Current = Cursors.Default;
        }