//初始化数据 public void InitializeApp() { //Getyydh(); dg_hygl.AutoGenerateColumns = false; if (Getyydh() != "" && Getyydh() != null) { DS_Hygl = B_Hhygl.GetList("id>=0 and yydh in(" + Getyydh() + ") and djsj>'" + DateTime.Now.AddMonths(-12).ToString() + "' order by id desc"); } else { DS_Hygl = B_Hhygl.GetList("id>=0 and djsj>'" + DateTime.Now.AddMonths(-6).ToString() + "' order by id desc"); } bindingSource1.DataSource = DS_Hygl.Tables[0]; dg_count = DS_Hygl.Tables[0].Rows.Count; }
//根据hykh_bz读取hykh public static string GetHygl(string hykh_bz) { string get_value = ""; BLL.Hhygl B_Hhygl = new BLL.Hhygl(); Model.Hhygl M_Hhygl = new Model.Hhygl(); DataSet ds = B_Hhygl.GetList("hykh_bz='" + hykh_bz + "'"); if (ds.Tables[0].Rows.Count > 0) { get_value = ds.Tables[0].Rows[0]["parent_hykh"].ToString(); } return(get_value); }
//下载会员信息 public static void DownLoad_Hygl() { BLL.Hhygl B_Hhygl = new BLL.Hhygl(); Model.Hhygl M_Hhygl = new Model.Hhygl(); string yydh = common_file.Common.Getqyxx(1); string s = common_file.common_app.get_failure; DataSet DS_download = new DataSet(); int rows = 0; string csdatatime = "1800-01-01"; //远程传过来的初始时间 string jsdatatime = "1800-01-01"; //远程传过来的结束时间 url = common_file.Common.ReadXML("add", "url") + "/Hhygl/Hhygl_app.asmx"; object[] args = new object[5]; args[0] = yydh; args[1] = rows; args[2] = csdatatime; args[3] = jsdatatime; args[4] = DS_download; object result = jdgl_res_head_app.DynamicWebServiceCall.InvokeWebService(url, "Hhygl_download", args); if (result.ToString() == common_file.common_app.get_suc) { DS_download = (DataSet)args[4]; //下载好后把值传给本地数据库 jsdatatime = (String)args[3]; //读取结束时间 csdatatime = (String)args[2]; //读取初始时间 foreach (DataRow dr in DS_download.Tables[0].Rows) { string hykh_service = dr["hykh"].ToString();//读取会员卡号 M_Hhygl.yydh = dr["yydh"].ToString(); M_Hhygl.qymc = dr["qymc"].ToString(); M_Hhygl.hyrx = dr["hyrx"].ToString(); M_Hhygl.hykh = dr["hykh"].ToString(); M_Hhygl.hykh_bz = dr["hykh_bz"].ToString(); M_Hhygl.krxm = dr["krxm"].ToString(); M_Hhygl.krgj = dr["krgj"].ToString(); M_Hhygl.krmz = dr["krmz"].ToString(); M_Hhygl.yxzj = dr["yxzj"].ToString(); M_Hhygl.zjhm = dr["zjhm"].ToString(); M_Hhygl.krsr = Convert.ToDateTime(dr["krsr"].ToString()); M_Hhygl.krdh = dr["krdh"].ToString(); M_Hhygl.krsj = dr["krsj"].ToString(); M_Hhygl.krEmail = dr["krEmail"].ToString(); M_Hhygl.krdz = dr["krdz"].ToString(); M_Hhygl.krzy = dr["krzy"].ToString(); M_Hhygl.krdw = dr["krdw"].ToString(); M_Hhygl.qzrx = dr["qzrx"].ToString(); M_Hhygl.qzhm = dr["qzhm"].ToString(); M_Hhygl.zjyxq = Convert.ToDateTime(dr["zjyxq"].ToString()); M_Hhygl.tlyxq = Convert.ToDateTime(dr["tlyxq"].ToString()); M_Hhygl.tjrq = Convert.ToDateTime(dr["tjrq"].ToString()); M_Hhygl.lzka = dr["lzka"].ToString(); M_Hhygl.bz = dr["bz"].ToString(); M_Hhygl.djsj = Convert.ToDateTime(dr["djsj"].ToString()); M_Hhygl.hyjf = Convert.ToDecimal(dr["hyjf"].ToString()); M_Hhygl.shsc = true; M_Hhygl.scsj = Convert.ToDateTime(jsdatatime);//取结束时间 M_Hhygl.xgsj = Convert.ToDateTime(dr["xgsj"].ToString()); M_Hhygl.shxg = false; M_Hhygl.shqr = true; M_Hhygl.is_top = Convert.ToBoolean(dr["is_top"].ToString()); M_Hhygl.is_select = Convert.ToBoolean(dr["is_select"].ToString()); M_Hhygl.fkje = Convert.ToDecimal(dr["fkje"].ToString()); M_Hhygl.parent_hykh = dr["parent_hykh"].ToString(); //主卡 M_Hhygl.czy = dr["czy"].ToString(); M_Hhygl.xsy = dr["xsy"].ToString(); //根据会员卡号读出相同的数据如果相同就修改,不然就直接下载到会员表 DataSet DS_Hhyglservice = new DataSet(); DS_Hhyglservice = B_Hhygl.GetList("hykh='" + hykh_service + "'"); if (DS_Hhyglservice != null && DS_Hhyglservice.Tables[0].Rows.Count > 0) { M_Hhygl.id = Convert.ToInt32(DS_Hhyglservice.Tables[0].Rows[0]["id"].ToString()); if (B_Hhygl.Update(M_Hhygl)) { s = common_file.common_app.get_suc; } } else { if (B_Hhygl.Add(M_Hhygl) > 0) { s = common_file.common_app.get_suc; } } } try { common_file.Common_hygl.Update_hygljf(DS_download);//下载完后重新计算积分 } catch { } } Common.AddMsg(DS_download, "下载会员信息记录"); }