//2012.5.11本地传到远程的Qskyd_fjrb_temp然后在添加到Qskyd_fjrb表 //1.如果有相同的lsbh就修改,否者添加。 //2.最后和Qskyd_fjrb_temp这张表对比,如果Qskyd_fjrb not in(lsbh)的条件就删除 //这样做是怕本的删除了远程有可能还有这条记录在 public static string Add_Qskyd_fjrb(DataSet DS_Qskyd_fjrb, string yydh) { // id,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 string s = common_file.common_app.get_failure; if (DS_Qskyd_fjrb != null && DS_Qskyd_fjrb.Tables[0].Rows.Count > 0) { string strsql_03 = "delete from Qskyd_fjrb where isok=1 and yydh='" + yydh + "'"; DbHelperSQL.ExecuteSql(strsql_03); Model.Qskyd_fjrb M_Qskyd_fjrb = new Model.Qskyd_fjrb(); BLL.Qskyd_fjrb B_Qskyd_fjrb = new BLL.Qskyd_fjrb(); foreach (DataRow dr in DS_Qskyd_fjrb.Tables[0].Rows) { string strLsbh = dr["lsbh"].ToString(); M_Qskyd_fjrb.lsbh = dr["lsbh"].ToString(); M_Qskyd_fjrb.yydh = dr["yydh"].ToString(); M_Qskyd_fjrb.qymc = dr["qymc"].ToString(); M_Qskyd_fjrb.krxm = dr["krxm"].ToString(); M_Qskyd_fjrb.sktt = dr["sktt"].ToString(); M_Qskyd_fjrb.yddj = dr["yddj"].ToString(); M_Qskyd_fjrb.fjrb = dr["fjrb"].ToString(); M_Qskyd_fjrb.fjbh = dr["fjbh"].ToString(); M_Qskyd_fjrb.ddsj = Convert.ToDateTime(dr["ddsj"].ToString()); M_Qskyd_fjrb.lksj = Convert.ToDateTime(dr["lksj"].ToString()); M_Qskyd_fjrb.lzfs = Convert.ToDecimal(dr["lzfs"].ToString()); M_Qskyd_fjrb.shqh = dr["shqh"].ToString(); M_Qskyd_fjrb.fjjg = Convert.ToDecimal(dr["fjjg"].ToString()); M_Qskyd_fjrb.sjfjjg = Convert.ToDecimal(dr["sjfjjg"].ToString()); M_Qskyd_fjrb.yh = ""; M_Qskyd_fjrb.yhbl = 0; M_Qskyd_fjrb.bz = ""; M_Qskyd_fjrb.is_top = false; M_Qskyd_fjrb.is_select = false; M_Qskyd_fjrb.shsc = true; M_Qskyd_fjrb.czy = dr["czy"].ToString(); M_Qskyd_fjrb.czsj = Convert.ToDateTime(dr["czsj"].ToString()); M_Qskyd_fjrb.cznr = dr["cznr"].ToString(); M_Qskyd_fjrb.isok = true; //如果有相同lsbh就修改,,然后添加。 DataSet ds = B_Qskyd_fjrb.GetList("lsbh='" + strLsbh + "' and fjrb='" + dr["fjrb"].ToString() + "' and fjbh='" + dr["fjbh"].ToString() + "' and lzfs='" + dr["lzfs"].ToString() + "' and ddsj='" + dr["ddsj"] + "' and lksj='" + dr["lksj"] + "' and isok=0 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { int fid = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()); string strsql_01 = "update Qskyd_fjrb set isok=1 where id=" + fid + ""; if (DbHelperSQL.ExecuteSql(strsql_01) > 0) { M_Qskyd_fjrb.id = fid; B_Qskyd_fjrb.Update(M_Qskyd_fjrb); s = common_file.common_app.get_suc; } } else { //添加到Qskyd_fjrb表里 if (B_Qskyd_fjrb.Add(M_Qskyd_fjrb) > 0) { s = common_file.common_app.get_suc; } } } string strsql = "delete from Qskyd_fjrb where isok=0 and yydh='" + yydh + "'"; DbHelperSQL.ExecuteSql(strsql); string strsql_02 = "update Qskyd_fjrb set isok=0 where yydh='" + yydh + "'"; DbHelperSQL.ExecuteSql(strsql_02); s = common_file.common_app.get_suc; } return(s); }
//2012.5.11本地传到远程的Qskyd_fjrb_temp然后在添加到Qskyd_fjrb表 //1.如果有相同的lsbh就修改,否者添加。 //2.最后和Qskyd_fjrb_temp这张表对比,如果Qskyd_fjrb not in(lsbh)的条件就删除 //这样做是怕本的删除了远程有可能还有这条记录在 public static string Add_Qskyd_fjrb(DataSet DS_Qskyd_fjrb, string yydh) { // id,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 string s = common_file.common_app.get_failure; if (DS_Qskyd_fjrb != null && DS_Qskyd_fjrb.Tables[0].Rows.Count > 0) { Model.Qskyd_fjrb M_Qskyd_fjrb = new Model.Qskyd_fjrb(); BLL.Qskyd_fjrb B_Qskyd_fjrb = new BLL.Qskyd_fjrb(); string strlsbh_ds = ""; //记录总的lsbh以“,”号隔开 foreach (DataRow dr in DS_Qskyd_fjrb.Tables[0].Rows) { string strLsbh = dr["lsbh"].ToString(); M_Qskyd_fjrb.lsbh = dr["lsbh"].ToString(); M_Qskyd_fjrb.yydh = dr["yydh"].ToString(); M_Qskyd_fjrb.qymc = dr["qymc"].ToString(); M_Qskyd_fjrb.krxm = dr["krxm"].ToString(); M_Qskyd_fjrb.sktt = dr["sktt"].ToString(); M_Qskyd_fjrb.yddj = dr["yddj"].ToString(); M_Qskyd_fjrb.fjrb = dr["fjrb"].ToString(); M_Qskyd_fjrb.fjbh = dr["fjbh"].ToString(); M_Qskyd_fjrb.ddsj = Convert.ToDateTime(dr["ddsj"].ToString()); M_Qskyd_fjrb.lksj = Convert.ToDateTime(dr["lksj"].ToString()); M_Qskyd_fjrb.lzfs = Convert.ToDecimal(dr["lzfs"].ToString()); M_Qskyd_fjrb.shqh = dr["shqh"].ToString(); M_Qskyd_fjrb.fjjg = Convert.ToDecimal(dr["fjjg"].ToString()); M_Qskyd_fjrb.sjfjjg = Convert.ToDecimal(dr["sjfjjg"].ToString()); M_Qskyd_fjrb.yh = ""; M_Qskyd_fjrb.yhbl = 0; M_Qskyd_fjrb.bz = ""; M_Qskyd_fjrb.is_top = false; M_Qskyd_fjrb.is_select = false; M_Qskyd_fjrb.shsc = true; M_Qskyd_fjrb.czy = dr["czy"].ToString(); M_Qskyd_fjrb.czsj = Convert.ToDateTime(dr["czsj"].ToString()); M_Qskyd_fjrb.cznr = dr["cznr"].ToString(); //如果有相同lsbh就修改,,然后添加。 DataSet ds = B_Qskyd_fjrb.GetList("lsbh='" + strLsbh + "' and fjrb='" + dr["fjrb"].ToString() + "'"); if (ds != null && ds.Tables[0].Rows.Count > 0) { int fid = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()); M_Qskyd_fjrb.id = fid; if (B_Qskyd_fjrb.Update(M_Qskyd_fjrb)) { s = common_file.common_app.get_suc; } } else { //添加到Qskyd_fjrb表里 if (B_Qskyd_fjrb.Add(M_Qskyd_fjrb) > 0) { s = common_file.common_app.get_suc; } } strlsbh_ds += "'" + strLsbh + "'" + ","; //累加lsbh以“,”号相隔 } s = common_file.common_app.get_suc; //相反不相等的话就删除,防止本地删除中央服务器还没有删除lsbh not in if (strlsbh_ds.Length != 0) { strlsbh_ds = strlsbh_ds.Remove(strlsbh_ds.Length - 1, 1);//删除最后一个,号 string strsql = "delete from Qskyd_fjrb where lsbh not in(" + strlsbh_ds + ") and yydh='" + yydh + "'"; DbHelperSQL.Exists(strsql); s = common_file.common_app.get_suc; } } return(s); }
//下载网上预订的方法 public static int Download_orderFrom400() { Model.Qskyd_mainrecord M_Qskyd_mainrecord = new Model.Qskyd_mainrecord(); BLL.Qskyd_mainrecord B_Qskyd_mainrecord = new BLL.Qskyd_mainrecord(); string lsbh = ""; string ddbh = ""; int dlsum = 0; string ss = common_app.get_failure; url = common_file.Common.ReadXML("add", "url") + "/Qyddj/Qyddj_app.asmx"; DataSet DS_downloadData = new DataSet(); qymc = common_file.Common.Getqyxx(2); int rows = 0; bool status = false; object[] obj = new object[4]; obj[0] = qymc; obj[1] = rows; obj[2] = status; obj[3] = DS_downloadData; object result = jdgl_res_head_app.DynamicWebServiceCall.InvokeWebService(url, "yddj_download_DS", obj); ss = result.ToString(); if (ss == common_app.get_suc) { #region 预订中心数据处理 try { DS_downloadData = (DataSet)obj[3]; foreach (DataRow dr in DS_downloadData.Tables[0].Rows) { string sktt_value = dr[30].ToString(); //第一步,生成本地临时编号 string lflsbh = common_file.common_ddbh.ddbh("lf", "skyddate", "skydcounter", 6);; //联房编号 string Remote_lsbh = dr[3].ToString(); //远程lsbh string Local_yydh = dr[1].ToString(); //中心服务的yydh string yydh = dr[1].ToString(); qymc = dr[2].ToString(); int xfCount = 0; //如果是团体直接添加到本地Qttyd_mainrecord表中和中心服务器Qydlsbhbg_yy表插入数据 if (sktt_value == common_app.sktt_tt) { //id,yydh,qymc,lsbh,ddbh,hykh,hykh_bz,hyrx,krxm,krbh,ydrxm, //krgj,krmz,yxzj,zjhm,krxb,krsr,krdh,krsj,krEmail,krdz, //qtyq,krly,xyh,xydw,xsy,ddsj,lksj,czy,ydsj,sktt, //yddj,vip_type,fjrb,fjbh,sjjg,jsjg,lzfs,lzts,lzrs,sfqr, //ydxg,shxg,shsc Model.Qttyd_mainrecord M_Qttyd_mainrecord = new Model.Qttyd_mainrecord(); BLL.Qttyd_mainrecord B_Qttyd_mainrecord = new BLL.Qttyd_mainrecord(); lsbh = common_file.common_ddbh.ddbh("ttyd", "ttyddate", "ttydcounter", 6); ddbh = common_file.common_ddbh.ddbh("ttyd", "ttyddate", "ttydcounter", 6); M_Qttyd_mainrecord.cznr = common_app.cznr_add; M_Qttyd_mainrecord.czsj = DateTime.Now; M_Qttyd_mainrecord.czy = dr[28].ToString(); M_Qttyd_mainrecord.ddbh = ddbh; M_Qttyd_mainrecord.ddly = common_app.ddly; M_Qttyd_mainrecord.ddrx = ""; M_Qttyd_mainrecord.ddsj = Convert.ToDateTime(dr[26].ToString()).AddHours(12); M_Qttyd_mainrecord.ddwz = ""; M_Qttyd_mainrecord.ddyy = ""; M_Qttyd_mainrecord.ffshys = false; M_Qttyd_mainrecord.krbh = dr[9].ToString(); M_Qttyd_mainrecord.krdh = dr[17].ToString(); M_Qttyd_mainrecord.krdz = dr[20].ToString(); M_Qttyd_mainrecord.krEmail = dr[19].ToString(); M_Qttyd_mainrecord.krgj = dr[11].ToString(); M_Qttyd_mainrecord.krly = dr[22].ToString(); M_Qttyd_mainrecord.krsj = dr[18].ToString(); M_Qttyd_mainrecord.krxm = dr[8].ToString(); M_Qttyd_mainrecord.lksj = Convert.ToDateTime(dr[27].ToString()).AddHours(12); M_Qttyd_mainrecord.lsbh = lsbh; M_Qttyd_mainrecord.lzts = Convert.ToInt32(dr[38].ToString()); M_Qttyd_mainrecord.qtyq = dr[21].ToString(); M_Qttyd_mainrecord.qymc = qymc; M_Qttyd_mainrecord.sdcz = false; M_Qttyd_mainrecord.shsc = true; M_Qttyd_mainrecord.sktt = common_app.sktt_tt; M_Qttyd_mainrecord.syzd = ""; M_Qttyd_mainrecord.tsyq = ""; M_Qttyd_mainrecord.xsy = dr[25].ToString(); M_Qttyd_mainrecord.xydw = dr[24].ToString(); M_Qttyd_mainrecord.xyh = dr[23].ToString(); M_Qttyd_mainrecord.yddj = common_app.yddj_yd; M_Qttyd_mainrecord.ydrxm = dr[10].ToString(); M_Qttyd_mainrecord.yydh = yydh; M_Qttyd_mainrecord.zyzt = ""; M_Qttyd_mainrecord.ddyy = common_app.ddyy;//标志网上预订 M_Qskyd_mainrecord.zyzt = common_app.yddj_yd; B_Qttyd_mainrecord.Add(M_Qttyd_mainrecord); //向中心服务器加本地的新生成的lsbh,成功后修改web_skyd的shsc = 1都放在同一个存储过程注意, InsertToQyddjlsbhbg_yy(Remote_lsbh, lsbh, Local_yydh); } //第二步,1.sktt=散客,根据房间数量生成相对应的Qskyd_mainrecord主单和中心服务器Qydlsbhbg_yy表插入数据,修改Qskyd_fjrb表里的fjrb,lzfs,shsc,并且添加到联房。 // 2.sktt=团体,如果是第一条房型的话就直接修改Qskyd_fjrb,第二种房型就直接加到Qskyd_fjrb表 DataSet DS_Fjrb = Qskydfjrb_ds(qymc, Remote_lsbh); foreach (DataRow rb in DS_Fjrb.Tables[0].Rows) { xfCount++; string lzfs = rb[12].ToString().Substring(0, rb[12].ToString().TrimEnd().IndexOf(".")); int qc_lzfsa = int.Parse(lzfs.ToString()); string qc_fjrb = rb[8].ToString(); //房间类别 decimal qc_lzfs = Convert.ToDecimal(rb[12].ToString()); //入住房数 decimal qc_fjjg = Convert.ToDecimal(rb[14].ToString()); if (qc_lzfsa > 0) { #region 如果sktt=散客。 if (sktt_value == common_app.sktt_sk)//如果是散客 { for (int i = 0; i <= qc_lzfsa - 1; i++) { //id,yydh,qymc,lsbh,ddbh,hykh,hykh_bz,hyrx,krxm,krbh,ydrxm, //krgj,krmz,yxzj,zjhm,krxb,krsr,krdh,krsj,krEmail,krdz, //qtyq,krly,xyh,xydw,xsy,ddsj,lksj,czy,ydsj,sktt, //yddj,vip_type,fjrb,fjbh,sjjg,jsjg,lzfs,lzts,lzrs,sfqr, //ydxg,shxg,shsc lsbh = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6); ddbh = common_file.common_ddbh.ddbh("skyd", "skyddate", "skydcounter", 6); string krxm = dr[8].ToString(); M_Qskyd_mainrecord.lsbh = lsbh; M_Qskyd_mainrecord.yydh = yydh; M_Qskyd_mainrecord.qymc = qymc; M_Qskyd_mainrecord.ddbh = ddbh; M_Qskyd_mainrecord.hykh = dr[5].ToString(); M_Qskyd_mainrecord.hyrx = dr[7].ToString(); M_Qskyd_mainrecord.krxm = krxm; M_Qskyd_mainrecord.krgj = dr[11].ToString(); M_Qskyd_mainrecord.krmz = dr[12].ToString(); M_Qskyd_mainrecord.yxzj = dr[13].ToString(); M_Qskyd_mainrecord.zjhm = dr[14].ToString(); M_Qskyd_mainrecord.krxb = dr[15].ToString(); M_Qskyd_mainrecord.krsj = dr[18].ToString(); M_Qskyd_mainrecord.krEmail = dr[19].ToString(); M_Qskyd_mainrecord.krdz = dr[20].ToString(); M_Qskyd_mainrecord.krly = dr[22].ToString(); M_Qskyd_mainrecord.yddj = common_app.yddj_yd; M_Qskyd_mainrecord.sktt = common_app.sktt_sk; M_Qskyd_mainrecord.ddly = common_app.ddly; M_Qskyd_mainrecord.cznr = common_app.cznr_add; M_Qskyd_mainrecord.xyh = dr[23].ToString(); M_Qskyd_mainrecord.xydw = dr[24].ToString(); M_Qskyd_mainrecord.xsy = dr[25].ToString(); M_Qskyd_mainrecord.ddsj = Convert.ToDateTime(dr[26].ToString()).AddHours(12); M_Qskyd_mainrecord.lksj = Convert.ToDateTime(dr[27].ToString()).AddHours(12); M_Qskyd_mainrecord.czy = dr[28].ToString(); M_Qskyd_mainrecord.hykh_bz = dr[6].ToString(); M_Qskyd_mainrecord.lzts = Convert.ToInt32(dr[38].ToString()); M_Qskyd_mainrecord.shsc = true; M_Qskyd_mainrecord.ddyy = common_app.ddyy; //标志网上预订 M_Qskyd_mainrecord.zyzt = common_app.yddj_yd; M_Qskyd_mainrecord.qtyq = dr[21].ToString(); //其它要求 B_Qskyd_mainrecord.Add(M_Qskyd_mainrecord); //向中心服务器加本的新生成的lsbh成功后修改web_skyd各web_Qskyd_fjrb中字段shsc = 1都放在同一个存储过程注意; InsertToQyddjlsbhbg_yy(Remote_lsbh, lsbh, Local_yydh); //下载完后修改本地Qskyd_fjrb表fjrb,fjjg等 Qskyd_fjrb_Update(lsbh, qc_fjrb, 1, qc_fjjg, qc_fjjg); //下载完后添加到联房里 Common_flfsz.Flfsz_add(yydh, qymc, lflsbh, lsbh, "", krxm, common_app.sktt_sk, common_app.yddj_yd, dr[28].ToString()); } dlsum = int.Parse(DS_downloadData.Tables[0].Rows.Count.ToString());//返回行数 } #endregion #region 如果是团体 else if (sktt_value == common_app.sktt_tt)//如果是团体 { //修改本地Qskyd_fjrb表中的房型 //1.如果是第一条房型的话就直接修改Qskyd_fjrb。 //2.除第一条其它数据就直接添加房型 if (xfCount == 1) { Qskyd_fjrb_Update(lsbh, qc_fjrb, qc_lzfs, qc_fjjg, qc_fjjg); } else { Model.Qskyd_fjrb M_fjrb = new Model.Qskyd_fjrb(); BLL.Qskyd_fjrb B_fjrb = new BLL.Qskyd_fjrb(); M_fjrb.yydh = yydh; M_fjrb.yddj = common_app.yddj_yd; M_fjrb.sktt = common_app.sktt_tt; M_fjrb.sjfjjg = Convert.ToDecimal(rb[15].ToString()); M_fjrb.shsc = true; M_fjrb.shqh = rb[13].ToString(); M_fjrb.qymc = qymc; M_fjrb.lzfs = Convert.ToDecimal(rb[12].ToString()); M_fjrb.lsbh = lsbh; M_fjrb.lksj = Convert.ToDateTime(dr[27].ToString()).AddHours(12); M_fjrb.krxm = rb[5].ToString(); M_fjrb.fjrb = rb[8].ToString(); M_fjrb.fjjg = Convert.ToDecimal(rb[15].ToString()); M_fjrb.fjbh = ""; M_fjrb.fjbm = ""; M_fjrb.ddsj = Convert.ToDateTime(dr[26].ToString()).AddHours(12); M_fjrb.bz = rb[16].ToString(); M_fjrb.cznr = common_app.cznr_add; M_fjrb.czy = dr[28].ToString(); B_fjrb.Add(M_fjrb); } dlsum = int.Parse(DS_downloadData.Tables[0].Rows.Count.ToString());//返回行数 } #endregion //UpdateWeb_skyd_fjrb_shsc(int.Parse(rb[0].ToString())); } } } return(dlsum); } catch (Exception ee) { errorInfo = ee.Message.ToString(); postion = "向本地Qskyd_mainrecord插入数据之后到修改远程服务器下载数据的过程之中"; Common.WriteLog(errorInfo, postion); } #endregion } return(dlsum); }