Esempio n. 1
0
        private void b_save_Click(object sender, EventArgs e)
        {
            common_file.common_app.get_czsj();
            if (tB_title.Text == "")
            {
                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,类型名称不能为空。");
                tB_title.Focus();
            }
            else
            {
                string   url  = common_file.common_app.service_url + "Hhygl/Hhygl_app.asmx";
                object[] args = new object[4];
                args[0] = Hhyjfjpclass_id;
                args[1] = tB_title.Text.Trim().Replace("'", "-");
                args[2] = judge_add_edit;
                args[3] = common_file.common_app.xxzs;

                Hotel_app.Server.Hhygl.Hhyjf_jp_class Hhyjf_jp_class_services = new Hotel_app.Server.Hhygl.Hhyjf_jp_class();
                string result = Hhyjf_jp_class_services.Hhyjfjpclass_add_edit(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString());

                //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Hhyjfjpclass_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_title.Text = ""; tB_title.Focus();
                    }
                    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;
        }
Esempio n. 2
0
        private void b_delete_Click(object sender, EventArgs e)
        {
            common_file.common_app.get_czsj();
            if (DS_Hhyjfjpclass != null && DS_Hhyjfjpclass.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_jpclass.Rows[i].Cells[0].GetEditedFormattedValue(i, ss) != null && Convert.ToBoolean(this.dg_jpclass.Rows[i].Cells[0].GetEditedFormattedValue(i, ss)) == true)
                        {
                            //j = Convert.ToInt32(dg_jpclass.Rows[i].Index.ToString());

                            DataRowView dgr = dg_jpclass.Rows[i].DataBoundItem as DataRowView;
                            j = DS_Hhyjfjpclass.Tables[0].Rows.IndexOf(dgr.Row);

                            if (DS_Hhyjfjpclass.Tables[0].Rows[j]["id"].ToString() != "")
                            {
                                string   url  = common_file.common_app.service_url + "Hhygl/Hhygl_app.asmx";
                                string[] args = new string[4];
                                args[0] = DS_Hhyjfjpclass.Tables[0].Rows[j]["id"].ToString();
                                args[1] = "";
                                args[2] = common_file.common_app.get_delete;
                                args[3] = common_file.common_app.xxzs;

                                Hotel_app.Server.Hhygl.Hhyjf_jp_class Hhyjf_jp_class_services = new Hotel_app.Server.Hhygl.Hhyjf_jp_class();
                                string result = Hhyjf_jp_class_services.Hhyjfjpclass_add_edit(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString());
                                //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Hhyjfjpclass_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();
                }
            }
            else
            {
                common_file.common_app.Message_box_show(common_file.common_app.message_title, "你好,你没有选择任何信息");
            }
            Cursor.Current = Cursors.Default;
        }