Esempio n. 1
0
        public string Qskyd_fjrb_add_edit_delete_app_1(string id, string yydh, string qymc, string lsbh, string krxm, string sktt, string yddj, string fjrb, string fjbh, DateTime ddsj, DateTime lksj, Decimal lzfs, string shqh, decimal fjjg, decimal sjfjjg, string yh, decimal yhbl, string bz, string czy, DateTime czsj,
                                                       string cznr, string zyzt, string add_edit_delete, string xxzs, string fjbm, decimal jcje)
        {
            string s = common_file.common_app.get_failure;

            BLL.Qskyd_fjrb       B_temp             = new Hotel_app.BLL.Qskyd_fjrb();
            Model.Qskyd_fjrb     M_Qskyd_fjrb       = new Hotel_app.Model.Qskyd_fjrb();
            Ffjzt.Flfsz_add_edit Flfsz_add_edit_new = new Hotel_app.Server.Ffjzt.Flfsz_add_edit();
            BLL.Common           B_Common           = new Hotel_app.BLL.Common();
            DataSet ds = new DataSet();
            int     id_temp = 0; int id_temp2 = 0;
            int     j_temp = 1;
            string  lsbh_News = "";
            string  ddbh_News = "";
            string  lfbh_News = ""; int i_1 = 0;
            string  old_fjbh = "";

            BLL.Flfsz   B_flfsz = new Hotel_app.BLL.Flfsz();
            Model.Flfsz M_flfsz = new Hotel_app.Model.Flfsz();
            //if (sktt == common_file.common_sktt.sktt_sk || sktt == common_file.common_sktt.sktt_cz)
            {
                #region 预订新增房间类型
                //1.新增有房号的主单
                //2.修改新增主单里的房类信息把fjbh加进去并把lzfs设为1.
                //3.设置联房,要先去查看原来的临时编号有没有存在联房,有就不再重新生成联房编号,直接修改。
                //4.修改fjrb表,把没有房号的LZFS扣除1同时加到联房里,再修改现有主单里的房类信息

                if (add_edit_delete == common_file.common_app.get_add)
                {
                    if (yddj == common_file.common_yddj.yddj_yd)
                    {
                        if (lzfs > 1 && fjbh != "")
                        {
                            //新增客人主单
                            ds = B_Qskyd_mainrecord.GetList("lsbh='" + lsbh + "'");
                            if (ds != null && ds.Tables[0].Rows.Count > 0)
                            {
                                M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModel(Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()));

                                lsbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                ddbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                s         = common_file_server.Common_pl_Qskyd_mainRecord_add.Pladd(yydh, qymc, lsbh, lsbh_News, ddbh_News, czy, czsj.ToString(), "", "");//根据lsbh读起主单信息,添加一条有房号的记录。

                                if (s == common_file.common_app.get_suc)
                                {
                                    s = common_file.common_app.get_failure;
                                    //修改新增主单里的房类信息把fjbh加进去并把lzfs设为1.

                                    ds = B_temp.GetList("lsbh='" + lsbh_News + "'");
                                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                                    {
                                        Model.Qskyd_fjrb M_temp = B_temp.GetModel(Convert.ToInt32(ds.Tables[0].Rows[0]["id"]));
                                        M_temp.fjbh   = fjbh;
                                        M_temp.fjrb   = fjrb;
                                        M_temp.fjjg   = fjjg;
                                        M_temp.sjfjjg = sjfjjg;
                                        M_temp.yh     = yh;
                                        M_temp.yhbl   = yhbl;
                                        M_temp.shqh   = shqh;
                                        M_temp.bz     = bz;
                                        M_temp.lzfs   = 1;
                                        M_temp.fjbm   = fjbm;
                                        M_temp.jcje   = jcje;
                                        if (B_temp.Update(M_temp))
                                        {
                                            Qskyd_fjrb_add_edit_delete_new.add_fjbh_yd_fjzt(M_temp.lsbh, M_temp.fjbh, M_temp.sktt, czsj, czy, xxzs);



                                            #region 当前主单以前没有联房过()
                                            if (B_flfsz.GetModelList("lsbh='" + lsbh + "'").Count == 0)
                                            {
                                                //生成新的联房编号
                                                lfbh_News = common_file.common_ddbh.ddbh("lf", "lfdate", "lfcounter", 6);

                                                s = Flfsz_add_edit_new.Flfsz_add_edit_delete("", yydh, qymc, lfbh_News, lsbh_News, fjbh, krxm, sktt, yddj, czy, czsj.ToString(), common_file.common_app.shlz, common_file.common_app.get_add, xxzs);


                                                if (s == common_file.common_app.get_suc)
                                                {
                                                    //主单增加到联房,增加新的一条无房号的记录到fjrb表
                                                    lzfs = lzfs - 1;
                                                    if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, "", ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, DateTime.Now, cznr, zyzt, common_file.common_app.get_add, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                                    {
                                                        //新增临时编号到联房里面

                                                        string  fjbh_0  = "";
                                                        DataSet DS_temp = B_Common.GetList("select fjbh from Qskyd_fjrb", "lsbh='" + lsbh + "' and fjbh<>''");
                                                        if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                                                        {
                                                            fjbh_0 = DS_temp.Tables[0].Rows[0]["fjbh"].ToString();
                                                        }

                                                        s = Flfsz_add_edit_new.Flfsz_add_edit_delete("", yydh, qymc, lfbh_News, lsbh, fjbh_0, krxm, sktt, yddj, czy, czsj.ToString(), common_file.common_app.shlz, common_file.common_app.get_add, xxzs);


                                                        //M_flfsz.yydh = yydh;
                                                        //M_flfsz.qymc = qymc;
                                                        //M_flfsz.lsbh = lsbh;
                                                        //M_flfsz.fjbh = "";
                                                        //M_flfsz.lfbh = lfbh_News;
                                                        //M_flfsz.krxm = krxm;
                                                        //M_flfsz.sktt = sktt;
                                                        //M_flfsz.yddj = yddj;
                                                        //M_flfsz.czy = czy;
                                                        //M_flfsz.czsj = czsj;
                                                        //if (B_flfsz.Add(M_flfsz) > 0)
                                                        //{
                                                        //    s = common_file.common_app.get_suc;
                                                        //}
                                                        //else
                                                        //{
                                                        //    return s;
                                                        //}
                                                    }
                                                    else
                                                    {
                                                        return(s);
                                                    }
                                                }
                                                else
                                                {
                                                    return(s);
                                                }
                                            }
                                            #endregion

                                            #region 当前主单有联房过
                                            else
                                            {
                                                //直接把新增的一条加到联房表,fjbh不存在的一条不管
                                                lfbh_News = B_flfsz.GetModelList("lsbh='" + lsbh + "'")[0].lfbh;

                                                s = Flfsz_add_edit_new.Flfsz_add_edit_delete("", yydh, qymc, lfbh_News, lsbh_News, fjbh, krxm, sktt, yddj, czy, czsj.ToString(), common_file.common_app.shlz, common_file.common_app.get_add, xxzs);
                                                if (s == common_file.common_app.get_suc)
                                                {
                                                    //主单增加到联房,增加新的一条无房号的记录到fjrb表
                                                    lzfs = lzfs - 1;
                                                    if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, "", ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, DateTime.Now, cznr, zyzt, common_file.common_app.get_add, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                                    {
                                                        s = common_file.common_app.get_suc;
                                                    }
                                                    else
                                                    {
                                                        return(s);
                                                    }
                                                }
                                                else
                                                {
                                                    return(s);
                                                }
                                            }
                                            #endregion
                                        }
                                        else
                                        {
                                            return(s);
                                        }
                                    }
                                }
                                else
                                {
                                    return(s);
                                }
                            }
                        }//if (lzfs > 1 && fjbh != "")
                        else
                        {
                            j_temp = 1;
                            //如果原来已经有等一条已经排房的记录,新的(增加修改记录)房型一样且如果仍为1时的情况
                            if (B_temp.GetModelList("lsbh='" + lsbh + "' and fjrb='" + fjrb + "' and fjbh<>'' ").Count > 0)
                            {
                                j_temp = 3;
                            }
                            if (j_temp != 3)
                            {
                                //如果原来已经有等一条已经排房的记录,新的(增加修改记录)房型如果不一样且如果仍为1时的情况
                                #region 判断当前的临时编号对应的lzfs是否为1,并在fjrb表有多条记录的时候
                                if (B_temp.GetModelList("lsbh='" + lsbh + "' and fjrb<>'" + fjrb + "' and fjrb<>'' ").Count > 0)
                                {
                                    j_temp = 3;
                                }
                                #endregion

                                #region 只有一条记录的时候,直接修改fjrb,并加到联房表
                                else
                                {
                                    if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, cznr, zyzt, add_edit_delete, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                    {
                                        s = common_file.common_app.get_suc;
                                    }
                                    else
                                    {
                                        return(s);
                                    }
                                }
                            }
                            if (j_temp == 3)//输入房数为1时的判断,且原来有记录的情况
                            {
                                if (fjbh != "")
                                {
                                    //找到当前房间类型为1,而且还没有排房号的那条记录
                                    //M_Qskyd_fjrb = B_temp.GetModelList("lsbh='" + lsbh + "' and  fjrb='" + fjrb + "'  and  lzfs=1  and fjbh=''")[0];
                                    //得到主单的信息:
                                    lsbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                    ddbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                    //通过当前的主单信息新增一条新的记录
                                    if (common_file_server.Common_pl_Qskyd_mainRecord_add.Pladd(yydh, qymc, lsbh, lsbh_News, ddbh_News, czy, czsj.ToString(), "", "") == common_file.common_app.get_suc)
                                    {
                                        #region //修改fjrb表里当前生成这条记录的房间信息
                                        id_temp2 = GetModel("", lsbh_News).id;
                                        if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id_temp2.ToString(), yydh, qymc, lsbh_News, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, "自动新增", zyzt, common_file.common_app.get_edit, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                        {
                                            if (lf_GetResult(lsbh, qymc, lsbh_News, yydh, fjbh, krxm, sktt, yddj, czy, czsj, xxzs))
                                            {
                                                s = common_file.common_app.get_suc;
                                            }
                                        }
                                        #endregion
                                    }
                                }
                                else
                                {
                                    if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, cznr, zyzt, add_edit_delete, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                    {
                                        s = common_file.common_app.get_suc;
                                    }
                                    else
                                    {
                                        return(s);
                                    }
                                }
                            }



                            #endregion
                        }
                    }
                }
                #endregion
                #region 预订修改房间类型
                else
                if (add_edit_delete == common_file.common_app.get_edit)
                {
                    if (yddj == common_file.common_yddj.yddj_yd)
                    {
                        #region  新增主单lzfs > 1 && fjbh != ""

                        if (lzfs > 1 && fjbh != "")
                        {
                            //新增主单
                            //修改新增主单里的房类信息
                            //设置联房,要先去查看原来的临时编号有没有存在联房,有就不再重新生成联房编号

                            //把没有房号的LZFS扣除1同里加到联房里,再修改现有主单里的房类信息

                            ds = B_Qskyd_mainrecord.GetList("lsbh='" + lsbh + "'");
                            if (ds != null && ds.Tables[0].Rows.Count > 0)
                            {
                                M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModel(Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()));

                                lsbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                ddbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);

                                s = common_file_server.Common_pl_Qskyd_mainRecord_add.Pladd(yydh, qymc, lsbh, lsbh_News, ddbh_News, czy, czsj.ToString(), "", "");

                                if (s == common_file.common_app.get_suc)
                                {
                                    s = common_file.common_app.get_failure;
                                    //修改新增主单里的房类信息把fjbh加进去
                                    ds = B_temp.GetList("lsbh='" + lsbh_News + "'");
                                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                                    {
                                        //修改新增主单的Qskyd_fjrb表的fjbh并加到联房
                                        Model.Qskyd_fjrb M_temp = B_temp.GetModel(Convert.ToInt32(ds.Tables[0].Rows[0]["id"]));
                                        M_temp.fjbh   = fjbh;
                                        M_temp.fjrb   = fjrb;
                                        M_temp.fjjg   = fjjg;
                                        M_temp.sjfjjg = sjfjjg;
                                        M_temp.yh     = yh;
                                        M_temp.yhbl   = yhbl;
                                        M_temp.shqh   = shqh;
                                        M_temp.bz     = bz;
                                        M_temp.lzfs   = 1;
                                        M_temp.fjbm   = fjbm;
                                        M_temp.jcje   = jcje;
                                        //M_temp.id=Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);
                                        #region                                                                       //以前没有联房的处理节
                                        if (B_flfsz.GetModelList("lsbh='" + lsbh + "'").Count == 0)                   //以前没有联房
                                        {
                                            lfbh_News = common_file.common_ddbh.ddbh("lf", "lfdate", "lfcounter", 6); //

                                            s = Flfsz_add_edit_new.Flfsz_add_edit_delete("", yydh, qymc, lfbh_News, lsbh_News, fjbh, krxm, sktt, yddj, czy, czsj.ToString(), common_file.common_app.shlz, common_file.common_app.get_add, xxzs);



                                            //增加到联房,修改新增的主单fjrb表里的fjbh并把lzfs-1;并增加到联房)

                                            if (B_temp.Update(M_temp) && s == common_file.common_app.get_suc)
                                            {
                                                Qskyd_fjrb_add_edit_delete_new.add_fjbh_yd_fjzt(M_temp.lsbh, M_temp.fjbh, M_temp.sktt, czsj, czy, xxzs);



                                                ds  = B_temp.GetList("lsbh='" + lsbh + "'  and  fjrb='' and id='" + id.ToString() + "'");
                                                i_1 = 5;
                                                if (ds != null && ds.Tables[0].Rows.Count > 0)
                                                {
                                                    i_1 = 6;
                                                }
                                                else
                                                {
                                                    i_1 = 5;
                                                    ds  = B_temp.GetList("lsbh='" + lsbh + "'  and  fjrb<>''  and id='" + id.ToString() + "'");
                                                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                                                    {
                                                        if (ds.Tables[0].Rows[0]["fjrb"].ToString() == fjrb)
                                                        {
                                                            i_1 = 5;
                                                        }
                                                        else
                                                        {
                                                            i_1 = 7;
                                                        }
                                                    }
                                                }


                                                if (ds != null && ds.Tables[0].Rows.Count > 0)
                                                {
                                                    id_temp      = Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);
                                                    M_Qskyd_fjrb = B_temp.GetModel(id_temp);
                                                }

                                                if (i_1 == 5 || i_1 == 6 || i_1 == 7)
                                                {
                                                    M_Qskyd_fjrb.lzfs = lzfs - 1;
                                                    M_Qskyd_fjrb.czy  = czy;
                                                    M_Qskyd_fjrb.czsj = DateTime.Now;
                                                    M_Qskyd_fjrb.cznr = common_file.common_app.get_edit;
                                                    if (i_1 == 6 || i_1 == 7)
                                                    {
                                                        M_Qskyd_fjrb.fjrb = fjrb;
                                                        if (i_1 == 6)
                                                        {
                                                            M_Qskyd_fjrb.shqh   = shqh;
                                                            M_Qskyd_fjrb.fjjg   = fjjg;  //decimal.Parse(common_file.common_get_fjjg.get_fjjg(fjrb));
                                                            M_Qskyd_fjrb.sjfjjg = sjfjjg;
                                                            M_Qskyd_fjrb.yh     = yh;
                                                            M_Qskyd_fjrb.yhbl   = yhbl;
                                                            M_Qskyd_fjrb.bz     = bz;
                                                            M_Qskyd_fjrb.fjbm   = fjbm;
                                                            M_Qskyd_fjrb.bz     = bz;
                                                        }
                                                    }
                                                }
                                                if (B_temp.Update(M_Qskyd_fjrb))     //无房间编号的房类主单也加到联房表里面
                                                {
                                                    s = Flfsz_add_edit_new.Flfsz_add_edit_delete("", yydh, qymc, lfbh_News, lsbh, "", krxm, sktt, yddj, czy, czsj.ToString(), common_file.common_app.shlz, common_file.common_app.get_add, xxzs);
                                                }
                                                else
                                                {
                                                    return(s);
                                                }
                                            }
                                            else
                                            {
                                                return(s);
                                            }
                                        }

                                        #endregion

                                        #region 以前有联房
                                        else
                                        {
                                            //读出联房信息
                                            lfbh_News = B_flfsz.GetModelList("lsbh='" + lsbh + "'")[0].lfbh;
                                            //将新增主单加到联房表里面  同时  修改新增的一条fjrb表里面的信息
                                            M_Qskyd_fjrb = B_temp.GetModelList("lsbh='" + lsbh_News + "'")[0];
                                            //相同信息
                                            M_Qskyd_fjrb.fjrb = fjrb;
                                            M_Qskyd_fjrb.fjbh = fjbh;
                                            M_Qskyd_fjrb.cznr = common_file.common_app.get_edit;
                                            M_Qskyd_fjrb.czsj = DateTime.Now;
                                            M_Qskyd_fjrb.lzfs = 1;
                                            M_Qskyd_fjrb.fjjg = fjjg;
                                            M_Qskyd_fjrb.yh   = yh;
                                            M_Qskyd_fjrb.yhbl = yhbl;
                                            M_Qskyd_fjrb.shqh = shqh;
                                            M_Qskyd_fjrb.bz   = bz;
                                            M_Qskyd_fjrb.fjbm = fjbm;
                                            M_Qskyd_fjrb.jcje = jcje;


                                            s = Flfsz_add_edit_new.Flfsz_add_edit_delete("", yydh, qymc, lfbh_News, lsbh_News, fjbh, krxm, sktt, yddj, czy, czsj.ToString(), common_file.common_app.shlz, common_file.common_app.get_add, xxzs);



                                            if (s == common_file.common_app.get_suc && B_temp.Update(M_Qskyd_fjrb))
                                            {
                                                Qskyd_fjrb_add_edit_delete_new.add_fjbh_yd_fjzt(M_Qskyd_fjrb.lsbh, M_Qskyd_fjrb.fjbh, M_Qskyd_fjrb.sktt, czsj, czy, xxzs);


                                                //修改原来的fjrb表的信息

                                                //M_Qskyd_fjrb = B_temp.GetModelList("lsbh='" + lsbh + "' and fjrb='" + fjrb + "'")[0];

                                                M_Qskyd_fjrb        = B_temp.GetModel(int.Parse(id));
                                                M_Qskyd_fjrb.id     = int.Parse(id);
                                                M_Qskyd_fjrb.lzfs   = lzfs - 1;
                                                M_Qskyd_fjrb.fjrb   = fjrb;
                                                M_Qskyd_fjrb.fjjg   = fjjg;
                                                M_Qskyd_fjrb.sjfjjg = sjfjjg;
                                                M_Qskyd_fjrb.yh     = yh;
                                                M_Qskyd_fjrb.yhbl   = yhbl;
                                                M_Qskyd_fjrb.shqh   = shqh;
                                                M_Qskyd_fjrb.bz     = bz;
                                                M_Qskyd_fjrb.fjbm   = fjbm;
                                                M_Qskyd_fjrb.jcje   = jcje;
                                                if (B_temp.Update(M_Qskyd_fjrb))
                                                {
                                                    s = common_file.common_app.get_suc;
                                                }
                                                else
                                                {
                                                    return(s);
                                                }
                                            }
                                            else
                                            {
                                                return(s);
                                            }
                                        }
                                        #endregion
                                    }
                                }
                                else
                                {
                                    return(s);
                                }
                            }
                        }
                        #endregion


                        else
                        {
                            #region 判断当前的临时编号对应的lzfs是否为1,并在fjrb表有多条记录的时候

                            DataSet DS_temp_1;
                            DS_temp_1 = B_temp.GetList("id='" + id + "'");
                            if (DS_temp_1 != null && DS_temp_1.Tables[0].Rows.Count > 0)
                            {
                                old_fjbh = DS_temp_1.Tables[0].Rows[0]["fjbh"].ToString();
                            }
                            j_temp = 1;
                            //如果原来已经有等一条已经排房的记录,新的(增加修改记录)房型一样且如果仍为1时的情况
                            if (B_temp.GetModelList("lsbh='" + lsbh + "' and fjrb='" + fjrb + "' and fjbh<>'' ").Count > 0)
                            {
                                j_temp = 3;
                            }
                            if (j_temp != 3)
                            {
                                if (B_temp.GetModelList("lsbh='" + lsbh + "' and fjrb<>'" + fjrb + "' and fjrb<>'' ").Count > 0)
                                {
                                    j_temp = 3;

                                    if (old_fjbh == "" && fjbh != "")
                                    {
                                        if (B_temp.GetModelList("lsbh='" + lsbh + "' and fjrb<>'" + fjrb + "' and fjrb<>'' and fjbh='' ").Count > 0)
                                        {
                                            j_temp = 1;
                                        }
                                    }
                                }
                                #endregion
                                #region 只有一条记录的时候,直接修改fjrb,并加到联房表
                                else
                                {
                                    if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, cznr, zyzt, add_edit_delete, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                    {
                                        s = common_file.common_app.get_suc;
                                    }
                                    else
                                    {
                                        return(s);
                                    }
                                }
                                #endregion
                            }

                            if (old_fjbh != "")
                            {
                                j_temp = 1;
                            }
                            if (j_temp == 3)
                            {
                                if (fjbh != "")
                                {
                                    //找到当前房间类型为1,而且还没有排房号的那条记录
                                    //M_Qskyd_fjrb = B_temp.GetModelList("lsbh='" + lsbh + "' and  fjrb='" + fjrb + "'  and  lzfs=1  and fjbh=''")[0];
                                    //得到主单的信息:
                                    lsbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                    ddbh_News = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6);
                                    //通过当前的主单信息新增一条新的记录
                                    if (common_file_server.Common_pl_Qskyd_mainRecord_add.Pladd(yydh, qymc, lsbh, lsbh_News, ddbh_News, czy, czsj.ToString(), "", "") == common_file.common_app.get_suc)
                                    {
                                        #region     //修改fjrb表里当前生成这条记录的房间信息
                                        id_temp2 = GetModel("", lsbh_News).id;
                                        if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id_temp2.ToString(), yydh, qymc, lsbh_News, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, "自动新增", zyzt, common_file.common_app.get_edit, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                        {
                                            //修改成功后,把当前原来fjrb表里面对应的那条记录删除
                                            if (GetModel(fjrb, lsbh) != null)
                                            {
                                                id_temp2 = int.Parse(id);
                                                if (B_temp.Delete(id_temp2))
                                                {
                                                    //删除对应记录成功后,把新生成的记录加到联房里
                                                    #region 判断当前的lsbh在不在在联房表里面,然后做相应处理
                                                    if (lf_GetResult(lsbh, qymc, lsbh_News, yydh, fjbh, krxm, sktt, yddj, czy, czsj, xxzs))
                                                    {
                                                        s = common_file.common_app.get_suc;
                                                    }
                                                    #endregion
                                                }
                                            }
                                        }
                                        #endregion
                                    }
                                }
                                else
                                {
                                    if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, cznr, zyzt, add_edit_delete, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                    {
                                        s = common_file.common_app.get_suc;
                                    }
                                    else
                                    {
                                        return(s);
                                    }
                                }
                            }
                            else
                            {
                                if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, cznr, zyzt, add_edit_delete, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                                {
                                    s = common_file.common_app.get_suc;
                                }
                            }
                        }
                    }    //if (yddj == common_file.common_yddj.yddj_yd)
                    else
                    if (yddj == common_file.common_yddj.yddj_dj)
                    {
                        if (Qskyd_fjrb_add_edit_delete_new.Qskyd_fjrb_add_edit_delete_app(id.ToString(), yydh, qymc, lsbh, krxm, sktt, yddj, fjrb, fjbh, ddsj, lksj, lzfs, shqh, fjjg, sjfjjg, yh, yhbl, bz, czy, czsj, cznr, zyzt, add_edit_delete, xxzs, fjbm, jcje) == common_file.common_app.get_suc)
                        {
                            s = common_file.common_app.get_suc;
                        }
                        else
                        {
                            return(s);
                        }
                    }        //if (yddj == common_file.common_yddj.yddj_dj)
                }
                #endregion
                #region hy类型的时候
                else
                if (sktt == common_file.common_sktt.sktt_tt || sktt == common_file.common_sktt.sktt_hy)
                {
                    if (add_edit_delete == common_file.common_app.get_add)
                    {
                        if (yddj == common_file.common_yddj.yddj_yd)
                        {
                            //1.新增主单
                            //2.修改房类Qskyd_Fjrb表,把fjbh写进,lzfs设为1.
                            //3.修改没有带房号的临时编号lzfs减1
                        }
                    }
                    else
                    if (add_edit_delete == common_file.common_app.get_edit)
                    {
                    }
                }
                #endregion
            }
            ds.Dispose();
            return(s);
        }
Esempio n. 2
0
        /// <param name="zyzt"></param>//有三种状态,一种预订、一种登记、一种预订转登记

        public string Qskyd_fjrb_add_edit_delete_app(string id, string yydh, string qymc, string lsbh, string krxm, string sktt, string yddj, string fjrb, string fjbh, DateTime ddsj, DateTime lksj, Decimal lzfs, string shqh, decimal fjjg, decimal sjfjjg, string yh, decimal yhbl, string bz, string czy, DateTime czsj, string cznr, string zyzt, string add_edit_delete, string xxzs, string fjbm, decimal jcje)
        {
            string s = common_file.common_app.get_failure;

            BLL.Qskyd_fjrb   B_Qskyd_fjrb = new Hotel_app.BLL.Qskyd_fjrb();
            BLL.Common       B_Common = new Hotel_app.BLL.Common();
            BLL.Ffjzt        B_Ffjzt = new Hotel_app.BLL.Ffjzt();
            Model.Qskyd_fjrb M_Qskyd_fjrb = new Hotel_app.Model.Qskyd_fjrb();
            Model.Ffjzt      M_Ffjzt = new Hotel_app.Model.Ffjzt();
            string           old_fjbh = "";
            string           old_fjbm = "";
            DataSet          ds_temp = B_Ffjzt.GetList("fjbh='" + fjbh + "'");
            string           krxm0 = ""; string sktt0 = ""; string lsbh0 = "";
            bool             shlf0 = false; bool shts0 = false; bool shvip0 = false;

            if (add_edit_delete == common_file.common_app.get_add)
            {
                M_Qskyd_fjrb.bz     = bz;
                M_Qskyd_fjrb.cznr   = cznr;
                M_Qskyd_fjrb.czsj   = czsj;
                M_Qskyd_fjrb.czy    = czy;
                M_Qskyd_fjrb.ddsj   = ddsj;
                M_Qskyd_fjrb.fjbh   = fjbh;
                M_Qskyd_fjrb.fjjg   = fjjg;
                M_Qskyd_fjrb.fjrb   = fjrb;
                M_Qskyd_fjrb.krxm   = krxm;
                M_Qskyd_fjrb.lksj   = lksj;
                M_Qskyd_fjrb.lsbh   = lsbh;
                M_Qskyd_fjrb.lzfs   = lzfs;
                M_Qskyd_fjrb.qymc   = qymc;
                M_Qskyd_fjrb.shqh   = shqh;
                M_Qskyd_fjrb.sjfjjg = sjfjjg;
                M_Qskyd_fjrb.sktt   = sktt;
                M_Qskyd_fjrb.yddj   = yddj;
                M_Qskyd_fjrb.yh     = yh;
                M_Qskyd_fjrb.yhbl   = yhbl;
                M_Qskyd_fjrb.yydh   = yydh;
                M_Qskyd_fjrb.fjbm   = fjbm;
                M_Qskyd_fjrb.jcje   = jcje;
                int IsSuc = B_Qskyd_fjrb.Add(M_Qskyd_fjrb);
                if (IsSuc > 0)
                {
                    s = common_file.common_app.get_suc;
                    if (zyzt == common_file.common_yddj.yddj_dj)
                    {
                        if (fjbh != "")
                        {
                            s = add_fjbh_dj_fjzt(fjbh, M_Qskyd_fjrb, czsj, czy, xxzs);
                        }
                    }
                    else
                    if (zyzt == common_file.common_yddj.yddj_yd)
                    {
                        if (fjbh != "")
                        {
                            s = add_fjbh_yd_fjzt(lsbh, fjbh, sktt, czsj, czy, xxzs);
                        }
                    }
                }
            }
            else
            if (add_edit_delete == common_file.common_app.get_edit)
            {
                M_Qskyd_fjrb = B_Qskyd_fjrb.GetModel(int.Parse(id));
                if (M_Qskyd_fjrb != null)
                {
                    old_fjbh = M_Qskyd_fjrb.fjbh;      //根据Id读取旧的房间编号old_fjbh
                    string   old_fjjg   = M_Qskyd_fjrb.fjjg.ToString();
                    string   old_sjfjjg = M_Qskyd_fjrb.sjfjjg.ToString();
                    DateTime old_ddsj   = M_Qskyd_fjrb.ddsj;
                    DateTime old_lksj   = M_Qskyd_fjrb.lksj;
                    M_Qskyd_fjrb.fjrb   = fjrb;
                    M_Qskyd_fjrb.fjbh   = fjbh;
                    M_Qskyd_fjrb.lzfs   = lzfs;
                    M_Qskyd_fjrb.shqh   = shqh;
                    M_Qskyd_fjrb.fjjg   = fjjg;
                    M_Qskyd_fjrb.sjfjjg = sjfjjg;
                    M_Qskyd_fjrb.yh     = yh;
                    M_Qskyd_fjrb.yhbl   = yhbl;
                    M_Qskyd_fjrb.bz     = bz;
                    M_Qskyd_fjrb.czy    = czy;
                    M_Qskyd_fjrb.czsj   = czsj;
                    M_Qskyd_fjrb.cznr   = cznr;
                    M_Qskyd_fjrb.fjbm   = fjbm;
                    M_Qskyd_fjrb.jcje   = jcje;
                    if (B_Qskyd_fjrb.Update(M_Qskyd_fjrb))
                    {
                        if (zyzt == common_file.common_yddj.yddj_dj) //如果yddj等于登记
                        {
                            if (old_fjbh != fjbh)                    //如果旧房间编号不等于新的房间编号说明换房了
                            {
                                s = common_file.common_app.get_failure;

                                if (fjbh != "")    //先把新的房号的房态先修改进去
                                {
                                    s = add_fjbh_dj_fjzt(fjbh, M_Qskyd_fjrb, czsj, czy, xxzs);
                                }

                                if (old_fjbh != "")    //如果原来房间编号不为空读出相关客人信息,然后把这间房间改为脏房
                                {
                                    s = clear_old_dj_fjzt(old_fjbh, czsj, czy, xxzs);
                                }

                                if (old_fjbh != "")
                                {
                                    common_file.common_czjl.add_czjl(yydh, qymc, czy, "换房", "原来房号:" + old_fjbh, "换后房号:" + fjbh, czsj);
                                }
                            }
                            if (fjbm == common_file.common_app.fjbm_bm && fjbh != "")    //修改房价保密的判断
                            {
                                B_Common.ExecuteSql("update Ffjzt set fjbm=1,czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh + "' and fjbm=0");
                            }
                            else
                            if (fjbm != common_file.common_app.fjbm_bm && fjbh != "")
                            {
                                B_Common.ExecuteSql("update Ffjzt set fjbm=0,czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh + "' and fjbm=1");
                            }
                        }
                        else
                        if (zyzt == common_file.common_yddj.yddj_yd) //如果yddj等于预订
                        {
                            if (old_fjbh != fjbh)                    //如果旧房间编号不等于新的房间编号说明换房了
                            {
                                if (old_fjbh != "")                  //如果原来房间编号不为空读出相关客人信息,然后把这间房间改为原来的状态
                                {
                                    s = clear_old_yd_fjzt(old_fjbh, old_ddsj, old_lksj, czsj, czy, xxzs);
                                }
                                if (fjbh != "")        //现在的房号不为空--预订
                                {
                                    s = add_fjbh_yd_fjzt(lsbh, fjbh, sktt, czsj, czy, xxzs);
                                }
                            }
                            if (fjbm == common_file.common_app.fjbm_bm && fjbh != "")        //修改房价保密的判断
                            {
                                B_Common.ExecuteSql("update Ffjzt set fjbm=1,czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh + "' and fjbm=0 and zyzt<>'" + common_file.common_fjzt.zzf + "' and yd_ddsj='" + M_Qskyd_fjrb.ddsj.ToString() + "' and yd_lksj='" + M_Qskyd_fjrb.lksj.ToString() + "'");
                            }
                            else
                            if (fjbm != common_file.common_app.fjbm_bm && fjbh != "")
                            {
                                B_Common.ExecuteSql("update Ffjzt set fjbm=0,czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh + "' and fjbm=1 and zyzt<>'" + common_file.common_fjzt.zzf + "' and yd_ddsj='" + M_Qskyd_fjrb.ddsj.ToString() + "' and yd_lksj='" + M_Qskyd_fjrb.lksj.ToString() + "'");
                            }
                        }
                        else
                        if (zyzt == common_file.common_yddj.yddj_ydzdj)
                        {
                            DataSet DS_temp_1 = B_Common.GetList("select * from Ffjzt", "fjbh='" + fjbh + "' and zyzt_second='" + common_file.common_fjzt.ydf + "' and yd_ddsj='" + M_Qskyd_fjrb.ddsj + "' and yd_lksj='" + M_Qskyd_fjrb.lksj + "'");
                            if (DS_temp_1 != null && DS_temp_1.Tables[0].Rows.Count >= 0)
                            {
                                clear_old_yd_fjzt(M_Qskyd_fjrb.fjbh, old_ddsj, old_lksj, czsj, czy, xxzs);
                                if (old_ddsj.ToShortDateString() != czsj.ToShortDateString())
                                {
                                    if (DateTime.Parse(old_ddsj.ToShortDateString()) > DateTime.Parse(czsj.ToShortDateString()))
                                    {
                                        common_file.common_czjl.add_czjl(yydh, qymc, czy, zyzt, krxm + "_" + fjrb + "_" + fjbh + "_" + lsbh, "由" + old_ddsj.ToShortDateString() + "提前至" + czsj.ToShortDateString(), czsj);
                                    }
                                    else
                                    if (DateTime.Parse(old_ddsj.ToShortDateString()) < DateTime.Parse(czsj.ToShortDateString()))
                                    {
                                        common_file.common_czjl.add_czjl(yydh, qymc, czy, zyzt, krxm + "_" + fjrb + "_" + fjbh + "_" + lsbh, "由" + old_ddsj.ToShortDateString() + "推迟至" + czsj.ToShortDateString(), czsj);
                                    }
                                }
                            }
                            if (add_fjbh_dj_fjzt(fjbh, M_Qskyd_fjrb, czsj, czy, xxzs) == common_file.common_app.get_suc)
                            {
                                B_Common.ExecuteSql("update Ffjzt set ddsj='" + ddsj.ToString() + "' where fjbh='" + fjbh + "'");
                            }
                        }
                        if (M_Qskyd_fjrb.fjbh == "")
                        {
                            string s_0 = "update Qskyd_fjrb set fjjg='" + M_Qskyd_fjrb.fjjg.ToString() + "',sjfjjg='" + M_Qskyd_fjrb.sjfjjg.ToString() + "' , yh='" + M_Qskyd_fjrb.yh + "' , yhbl='" + M_Qskyd_fjrb.yhbl.ToString() + "',fjbm='" + M_Qskyd_fjrb.fjbm + "' where (fjrb='" + M_Qskyd_fjrb.fjrb + "' and fjbh<>'') and (fjjg='" + old_fjjg + "' and sjfjjg='" + old_sjfjjg + "') and (lsbh in(select lsbh from Qskyd_mainrecord where ddbh in(select ddbh from Qttyd_mainrecord where lsbh='" + M_Qskyd_fjrb.lsbh + "')))";
                            B_Common.ExecuteSql(s_0);
                        }
                        s = common_file.common_app.get_suc;
                        //以下对房态进行再次修改以保证房态会自动刷新
                        if (M_Qskyd_fjrb.yddj == common_file.common_yddj.yddj_dj)
                        {
                            B_Common.ExecuteSql("update Ffjzt set czsj='" + DateTime.Now.ToString() + "'");
                        }
                        else
                        if (M_Qskyd_fjrb.yddj == common_file.common_yddj.yddj_yd)
                        {
                            if (M_Qskyd_fjrb.ddsj > DateTime.Parse(DateTime.Now.ToShortDateString()) && M_Qskyd_fjrb.ddsj < DateTime.Parse(DateTime.Now.AddDays(1).ToShortDateString()))
                            {
                                B_Common.ExecuteSql("update Ffjzt set czsj='" + DateTime.Now.ToString() + "'");
                            }
                        }
                    }
                }
            }
            else
            if (add_edit_delete == common_file.common_app.get_delete)
            {
                if (id != "")
                {
                    String s_0 = "insert into Qskyd_fjrb_temp(yydh,qymc,lsbh,krxm,sktt,yddj,fjrb,fjbh,ddsj,lksj,lzfs,shqh,fjjg,sjfjjg,yh,yhbl,bz,is_top,is_select,shsc,czy,czsj,cznr,sdcz,fjbm,jcje)";
                    s_0 = s_0 + "select yydh,qymc,lsbh,krxm,sktt,yddj,fjrb,fjbh,ddsj,lksj,lzfs,shqh,fjjg,sjfjjg,yh,yhbl,bz,is_top,is_select,shsc,'" + czy + "','" + czsj + "','" + cznr + "',sdcz,fjbm,jcje from Qskyd_fjrb where id='" + id + "'";
                    if (B_Common.ExecuteSql(s_0) > 0)
                    {
                        if (B_Qskyd_fjrb.Delete(int.Parse(id)) == true)
                        {
                            common_file.common_czjl.add_czjl(yydh, qymc, czy, "强制删除多排" + lzfs + fjrb, krxm, lsbh, czsj);
                            s = common_file.common_app.get_suc;
                        }
                    }
                }
            }
            ds_temp.Dispose();
            return(s);
        }