예제 #1
0
        private void b_delete_Click(object sender, EventArgs e)
        {
            if (yddj == common_file.common_yddj.yddj_dj)
            {
                if (common_file.common_roles.get_user_qx("B_sk_dj_ll_sc", common_file.common_app.user_type) == false)
                {
                    return;
                }
            }
            else
            {
                if (yddj == common_file.common_yddj.yddj_yd)
                {
                    if (common_file.common_roles.get_user_qx("B_sk_yd_ll_sc", common_file.common_app.user_type) == false)
                    {
                        return;
                    }
                }
            }


            common_file.common_app.get_czsj();
            string[] id_arg   = new string[dg_skdj.Rows.Count];
            int      sl_id    = 0;
            int      judge_ky = 2;//2可用,3不可用

            BLL.Common B_common  = new Hotel_app.BLL.Common();
            DataSet    ds_temp_0 = B_Common.GetList("select * from Qcounter", "id>=0");

            for (int j = 0; j < dg_count; j++)
            {
                common_file.common_app.get_czsj();
                DataGridViewDataErrorContexts ss = new DataGridViewDataErrorContexts();
                if (this.dg_skdj.Rows[j].Cells[0].GetEditedFormattedValue(j, ss) != null && Convert.ToBoolean(this.dg_skdj.Rows[j].Cells[0].GetEditedFormattedValue(j, ss)) == true)
                {
                    if (this.dg_skdj.Rows[j].Cells["id"].Value != null)
                    {
                        int         j_000 = 0;
                        DataRowView dgr   = dg_skdj.Rows[j].DataBoundItem as DataRowView;
                        j_000 = DS_Qskdj.Tables[0].Rows.IndexOf(dgr.Row);

                        judge_ky = 2;
                        if (j < dg_count)
                        {
                            ds_temp_0 = B_common.GetList("select id from Syjcz", "lsbh='" + DS_Qskdj.Tables[0].Rows[j_000]["lsbh"].ToString() + "'");
                            if (ds_temp_0 != null && ds_temp_0.Tables[0].Rows.Count > 0)
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,客人" + DS_Qskdj.Tables[0].Rows[j_000]["krxm"].ToString() + "有产生预收款了,如果确实要删除请先退还预收款!"); return;

                                judge_ky = 3;
                            }
                            if (judge_ky == 2)
                            {
                                ds_temp_0 = B_common.GetList("select id from Szwmx", "lsbh='" + DS_Qskdj.Tables[0].Rows[j_000]["lsbh"].ToString() + "'");
                                if (ds_temp_0 != null && ds_temp_0.Tables[0].Rows.Count > 0)
                                {
                                    common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,客人" + DS_Qskdj.Tables[0].Rows[j_000]["krxm"].ToString() + "有产生消费了,如果确实要删除请先转出相应消费!"); return;

                                    judge_ky = 3;
                                }
                            }
                            if (judge_ky == 2)
                            {
                                id_arg[j] = this.dg_skdj.Rows[j].Cells["id"].Value.ToString();
                            }
                        }
                        if (judge_ky == 2)
                        {
                            sl_id += 1;
                        }
                    }
                }
            }
            ds_temp_0.Dispose();

            if (id_arg.Length > 0 && sl_id <= 50 && sl_id > 0)
            {
                if (sl_id > 0)
                {
                    if (common_file.common_app.message_box_show_select(common_file.common_app.message_title, "你真的要删除所选的主单记录嘛?") == true)
                    {
                        Qyddj.Q_bz_input Q_bz_input_new = new Q_bz_input();
                        Q_bz_input_new.Text = "请输入操作理由";
                        Q_bz_input_new.Left = 200;
                        Q_bz_input_new.Top  = 150;
                        if (Q_bz_input_new.ShowDialog() == DialogResult.OK)
                        {
                            get_qxyy = Q_bz_input_new.get_bz;
                        }
                        Q_bz_input_new.Dispose();
                        common_file.common_app.get_czsj();



                        url  = common_file.common_app.service_url;
                        url += "Qyddj/Qyddj_app.asmx";
                        object[] args_1 = new object[8];
                        args_1[0] = id_arg;
                        args_1[1] = "sc";
                        args_1[2] = common_file.common_yddj.yddj_qx;
                        args_1[3] = get_qxyy;
                        args_1[4] = "";
                        args_1[5] = common_file.common_app.czy;
                        args_1[6] = DateTime.Now.ToString();
                        args_1[7] = common_file.common_app.xxzs;

                        Hotel_app.Server.Qyddj.Qyddj_add_edit_delete Qyddj_add_edit_delete_services = new Hotel_app.Server.Qyddj.Qyddj_add_edit_delete();

                        string result_temp = Qyddj_add_edit_delete_services.delete_sk_multi(id_arg, args_1[1].ToString(), args_1[2].ToString(), args_1[3].ToString(), args_1[4].ToString(), args_1[5].ToString(), args_1[6].ToString(), args_1[7].ToString());



                        //object result_temp = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "delete_sk_multi", args_1);
                        if (result_temp != null && result_temp == common_file.common_app.get_suc)
                        {
                            common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除记录成功!");
                            //如何删除会员有排房的预订,那么发短信提示删除



                            this.refresh_app("");
                        }
                        else
                        {
                            common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除记录失败!");
                        }
                    }
                }
            }
            else
            {
                string errorMsg = "";
                if (sl_id == 0)
                {
                    errorMsg = "没有选择任何记录,请选择你要删除的记录";
                }
                else
                {
                    errorMsg = "选择记录超过50条,请取消你超过的记录";
                }
                common_file.common_app.Message_box_show(common_file.common_app.message_title, errorMsg);
            }
            Cursor.Current = Cursors.Default;
        }
예제 #2
0
        private void b_delete_Click(object sender, EventArgs e)
        {
            if (yddj == common_file.common_yddj.yddj_dj)
            {
                if (common_file.common_roles.get_user_qx("B_tt_dj_ll_sc", common_file.common_app.user_type) == false)
                {
                    return;
                }
            }
            else
            {
                if (yddj == common_file.common_yddj.yddj_yd)
                {
                    if (common_file.common_roles.get_user_qx("B_tt_yd_ll_sc", common_file.common_app.user_type) == false)
                    {
                        return;
                    }
                }
            }



            common_file.common_app.get_czsj();
            int judge_cz = 1;//1为可以,2为不可以;

            if (dg_Qttdj.CurrentRow != null)
            {
                int         i     = dg_Qttdj.CurrentRow.Index;
                DataRowView dgr   = dg_Qttdj.CurrentRow.DataBoundItem as DataRowView;
                int         j_del = DS_ttdj.Tables[0].Rows.IndexOf(dgr.Row);
                if (i < dg_count)
                {
                    DataGridViewDataErrorContexts ss = new DataGridViewDataErrorContexts();
                    if (this.dg_Qttdj.Rows[i].Cells[0].GetEditedFormattedValue(i, ss) != null && Convert.ToBoolean(this.dg_Qttdj.Rows[i].Cells[0].GetEditedFormattedValue(i, ss)) == true)
                    {
                        if (common_file.common_app.message_box_show_select(common_file.common_app.message_title, "是否确定要删除此记录") == true)
                        {
                            judge_cz = 1;
                            BLL.Common B_Common  = new Hotel_app.BLL.Common();
                            DataSet    ds_temp_0 = B_common.GetList("select id from Syjcz", "lsbh='" + DS_ttdj.Tables[0].Rows[j_del]["lsbh"].ToString() + "'");
                            if (ds_temp_0 != null && ds_temp_0.Tables[0].Rows.Count > 0)
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,客人有产生预收款了,如果确实要删除请先退还预收款!");
                                return;
                            }
                            ds_temp_0 = B_common.GetList("select id from Szwmx", "lsbh='" + DS_ttdj.Tables[0].Rows[j_del]["lsbh"].ToString() + "'");
                            if (ds_temp_0 != null && ds_temp_0.Tables[0].Rows.Count > 0)
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,客人有产生消费了,如果确实要删除请先转出消费!");
                                return;
                            }
                            ds_temp_0 = B_common.GetList("select id from Syjcz", "lsbh in (select lsbh from Qskyd_mainrecord where ddbh='" + DS_ttdj.Tables[0].Rows[j_del]["ddbh"].ToString() + "')");
                            if (ds_temp_0 != null && ds_temp_0.Tables[0].Rows.Count > 0)
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,成员有产生预收款了,如果确实要删除请先退还成员的预收款!");
                                return;
                            }
                            ds_temp_0 = B_common.GetList("select id from Szwmx", "lsbh in (select lsbh from Qskyd_mainrecord where ddbh='" + DS_ttdj.Tables[0].Rows[j_del]["ddbh"].ToString() + "')");
                            if (ds_temp_0 != null && ds_temp_0.Tables[0].Rows.Count > 0)
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,成员有产生消费了,如果确实要删除请先转出成员的消费!");
                                return;
                            }


                            ds_temp_0 = B_common.GetList("select distinct yddj from Qskyd_mainrecord", "ddbh ='" + DS_ttdj.Tables[0].Rows[j_del]["ddbh"].ToString() + "' and (yddj='" + common_file.common_yddj.yddj_yd + "' or yddj='" + common_file.common_yddj.yddj_dj + "')");
                            if (ds_temp_0 != null)
                            {
                                if (ds_temp_0.Tables[0].Rows.Count > 1)
                                {
                                    common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,这是张有部分转登记的预订单,如果只是预订成员要取消请直接去预订界面删除成员预订单!如果要包括在住的单据都要取消,请先把所有预订成员都取消掉才可以!");
                                    return;
                                }
                            }



                            Qyddj.Q_bz_input Q_bz_input_new = new Q_bz_input();
                            Q_bz_input_new.Text = "请输入操作理由";
                            Q_bz_input_new.Left = 200;
                            Q_bz_input_new.Top  = 150;
                            if (Q_bz_input_new.ShowDialog() == DialogResult.OK)
                            {
                                get_qxyy = Q_bz_input_new.get_bz;
                            }
                            Q_bz_input_new.Dispose();



                            common_file.common_app.get_czsj();



                            string[] args = new string[34];
                            args[0]  = DS_ttdj.Tables[0].Rows[j_del]["id"].ToString();
                            args[1]  = "";
                            args[2]  = "";
                            args[3]  = "";
                            args[4]  = "";
                            args[5]  = "";
                            args[6]  = "";
                            args[7]  = "";
                            args[8]  = "";
                            args[9]  = "";
                            args[10] = "";
                            args[11] = "";
                            args[12] = "";
                            args[13] = "";
                            args[14] = "";
                            args[15] = "";
                            args[16] = "";
                            args[17] = "";
                            args[18] = "";
                            args[19] = "";
                            args[20] = "";
                            args[21] = "";
                            args[22] = get_qxyy;
                            args[23] = "";
                            args[24] = "";
                            args[25] = "";
                            args[26] = common_file.common_app.czy;
                            args[27] = common_file.common_yddj.yddj_qx;
                            args[28] = DateTime.Now.ToString();
                            args[29] = "";
                            args[30] = "";
                            args[31] = common_file.common_app.get_delete;
                            args[32] = common_file.common_app.xxzs;
                            args[33] = "";

                            Hotel_app.Server.Qyddj.Qttyd_add_edit_delete Qttyd_add_edit_delete_services = new Hotel_app.Server.Qyddj.Qttyd_add_edit_delete();
                            string result = Qttyd_add_edit_delete_services.Qttyd_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());
                            //object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Qttyd_add_edit_delete_app", args);
                            if (result == common_file.common_app.get_suc)
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除成功!");
                                refresh("");
                            }
                            else
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除失败!");
                            }
                            ds_temp_0.Clear();
                            ds_temp_0.Dispose();
                        }
                    }
                }
            }


            Cursor.Current = Cursors.Default;
        }