public JoinKoubeiModel selectOneById(long JoinID) { JoinKoubeiModel model = new JoinKoubeiModel(); string sqlStr = "select * from JoinkoubeiTab where Join_ID=" + JoinID.ToString(); DataSet ds_join = Tz888.DBUtility.DbHelperSQL.Query(sqlStr); if (ds_join != null && ds_join.Tables[0] != null && ds_join.Tables[0].Rows.Count > 0) { DataRow dr = ds_join.Tables[0].Rows[0]; model.Join_ID = JoinID; model.Join_StartTime = Convert.ToDateTime(dr["Join_StartTime"].ToString().Trim()); model.Join_EndTime = Convert.ToDateTime(dr["Join_EndTime"].ToString().Trim()); model.Join_LinkMan = dr["Join_LinkMan"].ToString().Trim(); model.Join_Tel = dr["Join_Tel"].ToString().Trim(); model.Join_Tel2 = dr["Join_Tel2"].ToString().Trim(); model.Join_Email = dr["Join_Email"].ToString().Trim(); model.Join_AreaCode = Convert.ToInt32(dr["Join_AreaCode"].ToString().Trim()); model.Join_URL = dr["Join_URL"].ToString(); model.Join_Type = Convert.ToInt32(dr["Join_Type"].ToString().Trim()); model.Join_State = Convert.ToInt32(dr["Join_State"].ToString()); model.Join_InfoType = dr["Join_InfoType"].ToString().Trim(); model.Join_InfoID = Convert.ToInt32(dr["Join_InfoID"].ToString().Trim()); } ds_join.Clear(); return(model); }
public string removeInfo(JoinKoubeiModel model) { string contact_person_Temp = model.Temp_contact_person; string contact_phone1_Temp = model.Temp_contact_phone1; string category_id = model.Temp_category_id; string partner_id = model.Temp_partner_id; string sign_key = model.Temp_sign_key; int debug = model.Temp_debug; string partner_offer_id = partner_offer_id_pre.Trim() + model.Join_ID.ToString().Trim(); string postString = ""; postString += "&partner_id=" + partner_id; postString += "&partner_offer_id=" + partner_offer_id; postString += "&sign_value=" + GetSign_value(partner_id, sign_key, category_id, partner_offer_id); byte[] byteArray = Encoding.UTF8.GetBytes(postString); HttpWebRequest webRequest2 = (HttpWebRequest)WebRequest.Create("http://api.fuwu.koubei.com/offer/OfferRemove"); webRequest2.Method = "POST"; webRequest2.ContentType = "application/x-www-form-urlencoded"; webRequest2.ContentLength = byteArray.Length; Stream newStream = webRequest2.GetRequestStream(); newStream.Write(byteArray, 0, byteArray.Length);//写入参数 newStream.Close(); HttpWebResponse response2 = (HttpWebResponse)webRequest2.GetResponse(); StreamReader sr2 = new StreamReader(response2.GetResponseStream(), Encoding.Default); string retStr = sr2.ReadToEnd(); string resultStr = dealInfoByRetStr(model.Join_ID, retStr); return(resultStr.ToString()); }
public void updateData(JoinKoubeiModel model) { SqlParameter[] paramUpdate = new SqlParameter[] { new SqlParameter("@Join_ID", model.Join_ID), new SqlParameter("@Join_InfoType", model.Join_InfoType), new SqlParameter("@Join_InfoID", model.Join_InfoID), new SqlParameter("@Join_URL", model.Join_URL), new SqlParameter("@Join_Type", model.Join_Type), new SqlParameter("@Join_AreaCode", model.Join_AreaCode), new SqlParameter("@Join_StartTime", model.Join_StartTime), new SqlParameter("@Join_EndTime", model.Join_EndTime), new SqlParameter("@Join_LinkMan", model.Join_LinkMan), new SqlParameter("@Join_Tel", model.Join_Tel), new SqlParameter("@Join_Tel2", model.Join_Tel2), new SqlParameter("@Join_Email", model.Join_Email), new SqlParameter("@Join_State", model.Join_State), new SqlParameter("@flag", "Update") }; Tz888.DBUtility.DbHelperSQL.RunProcedure("Proc_JoinkoubeiTab", paramUpdate, "join"); }
public JoinKoubeiModel selectOne(JoinKoubeiModel model) { SqlParameter[] paramselectOne = new SqlParameter[] { new SqlParameter("@Join_ID", model.Join_ID), new SqlParameter("@Join_InfoType", ""), new SqlParameter("@Join_InfoID", Convert.ToInt64("0")), new SqlParameter("@Join_URL", ""), new SqlParameter("@Join_Type", Convert.ToInt32("0")), new SqlParameter("@Join_AreaCode", Convert.ToInt32("0")), new SqlParameter("@Join_StartTime", Convert.ToDateTime(DateTime.Now)), new SqlParameter("@Join_EndTime", Convert.ToDateTime(DateTime.Now)), new SqlParameter("@Join_LinkMan", ""), new SqlParameter("@Join_Tel", ""), new SqlParameter("@Join_Tel2", ""), new SqlParameter("@Join_Email", ""), new SqlParameter("@Join_State", Convert.ToInt32("0")), new SqlParameter("@flag", "SelectOne") }; DataSet ds_join = DbHelperSQL.RunProcedure("Proc_JoinkoubeiTab", paramselectOne, "join"); if (ds_join != null && ds_join.Tables[0] != null && ds_join.Tables[0].Rows.Count > 0) { DataRow dr = ds_join.Tables[0].Rows[0]; model.Join_ID = model.Join_ID; model.Join_StartTime = Convert.ToDateTime(dr["Join_StartTime"].ToString().Trim()); model.Join_EndTime = Convert.ToDateTime(dr["Join_EndTime"].ToString().Trim()); model.Join_LinkMan = dr["Join_LinkMan"].ToString().Trim(); model.Join_Tel = dr["Join_Tel"].ToString().Trim(); model.Join_Tel2 = dr["Join_Tel2"].ToString().Trim(); model.Join_Email = dr["Join_Email"].ToString().Trim(); model.Join_AreaCode = Convert.ToInt32(dr["Join_AreaCode"].ToString().Trim()); model.Join_URL = dr["Join_URL"].ToString(); model.Join_Type = Convert.ToInt32(dr["Join_Type"].ToString().Trim()); model.Join_State = Convert.ToInt32(dr["Join_State"].ToString()); model.Join_InfoType = dr["Join_InfoType"].ToString().Trim(); model.Join_InfoID = Convert.ToInt32(dr["Join_InfoID"].ToString().Trim()); } ds_join.Clear(); return(model); }
public string insertData(JoinKoubeiModel model) { SqlParameter[] paramInsert = new SqlParameter[] { new SqlParameter("@Join_ID", model.Join_ID), new SqlParameter("@Join_InfoType", model.Join_InfoType), new SqlParameter("@Join_InfoID", model.Join_InfoID), new SqlParameter("@Join_URL", model.Join_URL), new SqlParameter("@Join_Type", model.Join_Type), new SqlParameter("@Join_AreaCode", model.Join_AreaCode), new SqlParameter("@Join_StartTime", model.Join_StartTime), new SqlParameter("@Join_EndTime", model.Join_EndTime), new SqlParameter("@Join_LinkMan", model.Join_LinkMan), new SqlParameter("@Join_Tel", model.Join_Tel), new SqlParameter("@Join_Tel2", model.Join_Tel2), new SqlParameter("@Join_Email", model.Join_Email), new SqlParameter("@Join_State", model.Join_State), new SqlParameter("@flag", "Insert") }; DataSet ds1 = DbHelperSQL.RunProcedure("Proc_JoinkoubeiTab", paramInsert, "join"); string join_ID = ds1.Tables["join"].Rows[0][0].ToString(); ds1.Clear(); return(join_ID); }
public JoinKoubeiModel getInfoFromMainInfo(string InfoType, long InfoID, string AreaAll) { JoinKoubeiModel model = new JoinKoubeiModel(); //商机15,创业7,招商13,项目19,投资6 //信息类别,信息表类型,获取信息From,获取信息Field, //string[] tableInfo = new string[] { // "Oppor;OpportunityInfoTab;MainInfoTab left join OpportunityInfoTab on MainInfoTab.ID=OpportunityInfoTab.InfoID left join SetCountyTab on OpportunityInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email", // "CarveOut;CarveOutInfoTab;MainInfoTab left join CarveOutInfoTab on MainInfoTab.ID=CarveOutInfoTab.InfoID left join SetCountyTab on CarveOutInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email", // "Merchant;MerchantInfoTab;MainInfoTab left join MerchantInfoTab on MainInfoTab.ID=MerchantInfoTab.InfoID left join InfoContactTab on MerchantInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on MerchantInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ZoneAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email", // "Project;ProjectInfoTab;MainInfoTab left join ProjectInfoTab on MainInfoTab.ID=ProjectInfoTab.InfoID left join InfoContactTab on ProjectInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on ProjectInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email", // "Capital;CapitalInfoTab;MainInfoTab left join CapitalInfoTab on MainInfoTab.ID=CapitalInfoTab.InfoID left join InfoContactTab on CapitalInfoTab.InfoID=InfoContactTab.InfoID left join CapitalInfoAreaTab on CapitalInfoTab.InfoID=CapitalInfoAreaTab.InfoID left join SetCountyTab on CapitalInfoAreaTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email" //}; string[] tableInfo = new string[] { "15;OpportunityInfoTab;MainInfoTab left join OpportunityInfoTab on MainInfoTab.ID=OpportunityInfoTab.InfoID left join SetCountyTab on OpportunityInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on OpportunityInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=OpportunityInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email,ProvinceName,CountryName", "7;CarveOutInfoTab;MainInfoTab left join CarveOutInfoTab on MainInfoTab.ID=CarveOutInfoTab.InfoID left join SetCountyTab on CarveOutInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on CarveOutInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=CarveOutInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email,ProvinceName,CountryName", "13;MerchantInfoTab;MainInfoTab left join MerchantInfoTab on MainInfoTab.ID=MerchantInfoTab.InfoID left join InfoContactTab on MerchantInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on MerchantInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on MerchantInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=MerchantInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ZoneAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email,ProvinceName,CountryName", "19;ProjectInfoTab;MainInfoTab left join ProjectInfoTab on MainInfoTab.ID=ProjectInfoTab.InfoID left join InfoContactTab on ProjectInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on ProjectInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on ProjectInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=ProjectInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email,ProvinceName,CountryName", "6;CapitalInfoTab;MainInfoTab left join CapitalInfoTab on MainInfoTab.ID=CapitalInfoTab.InfoID left join InfoContactTab on CapitalInfoTab.InfoID=InfoContactTab.InfoID left join CapitalInfoAreaTab on CapitalInfoTab.InfoID=CapitalInfoAreaTab.InfoID left join SetCountyTab on CapitalInfoAreaTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on CapitalInfoAreaTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=CapitalInfoAreaTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email,ProvinceName,CountryName" }; int type = 0; switch (InfoType.ToString()) { case "Oppor": type = 1; break; case "CarveOut": type = 2; break; case "Merchant": type = 3; break; case "Project": type = 4; break; case "Capital": type = 5; break; default: type = 0; break; } if (type == 0) { return(model); } string selectField = tableInfo[(type - 1)].Split(';')[3]; string selectTables = tableInfo[(type - 1)].Split(';')[2]; string selectTable = tableInfo[(type - 1)].Split(';')[1]; string sqlStr = "select " + selectField + " from " + selectTables + " where " + selectTable + ".InfoID=" + InfoID.ToString(); DataSet ds = DbHelperSQL.Query(sqlStr); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; model.Join_Content = dr["Content"].ToString().Trim(); //内容 model.Join_StartTime = Convert.ToDateTime(dr["ValidateStartTime"].ToString().Trim()); //model.Join_EndTime = model.Join_StartTime.AddDays(25); DateTime endTimeTemp = new DateTime(); switch (dr["ValidateTerm"].ToString().Trim()) { case "3": endTimeTemp = model.Join_StartTime.AddDays(90); break; case "6": endTimeTemp = model.Join_StartTime.AddDays(180); break; case "12": endTimeTemp = model.Join_StartTime.AddDays(360); break; } double days = 0; try { days = Convert.ToDouble(endDays); } catch { days = 7; } if (endTimeTemp >= System.DateTime.Now.AddDays(days) || endTimeTemp <= System.DateTime.Now) { model.Join_EndTime = System.DateTime.Now.AddDays(days); } else { model.Join_EndTime = endTimeTemp; } model.Join_LinkMan = dr["LinkMan"].ToString().Trim(); model.Join_Tel = dr["Tel"].ToString().Trim(); model.Join_Tel2 = dr["Mobile"].ToString().Trim(); model.Join_Email = dr["Email"].ToString().Trim(); model.Join_Title = dr["Title"].ToString().Trim(); model.Join_CountyName = dr["CountyName"].ToString().Trim(); //int areaIndex = AreaAll.IndexOf("," + dr["CountyName"].ToString().Trim() + ","); //if (areaIndex != -1) // model.Join_AreaCode = AreaAll.Substring(0, areaIndex).Split(',').Length + 2; //else // model.Join_AreaCode = 0; //ProvinceName,CountryName int areaIndex = AreaAll.IndexOf("," + dr["CountyName"].ToString().Trim() + ","); //县级区域 if (areaIndex == -1) { areaIndex = AreaAll.IndexOf("," + dr["ProvinceName"].ToString().Trim() + ","); //省级 if (areaIndex == -1) { areaIndex = AreaAll.IndexOf("," + dr["CountryName"].ToString().Trim() + ",");//国家 if (areaIndex == -1) { string CountryNameTemp = dr["CountryName"].ToString().Trim().Replace("中国", "");//如果是中国国香港 或者台湾的时候 //CountryName areaIndex = AreaAll.IndexOf("," + CountryNameTemp.Trim() + ","); } } } if (areaIndex != -1) { model.Join_AreaCode = AreaAll.Substring(0, areaIndex).Split(',').Length + 2; } else { model.Join_AreaCode = 0; } model.Join_URL = dr["HtmlFile"].ToString(); } ds.Clear(); return(model); }
public JoinKoubeiModel selectOne(JoinKoubeiModel model) { return(dal.selectOne(model)); }
public void updateData(JoinKoubeiModel model) { dal.updateData(model); }
public string insertData(JoinKoubeiModel model) { return(dal.insertData(model)); }
public string postInfo(string postType, JoinKoubeiModel model) { string contact_person_Temp = model.Temp_contact_person; string contact_phone1_Temp = model.Temp_contact_phone1; string category_id = model.Temp_category_id; string partner_id = model.Temp_partner_id; string sign_key = model.Temp_sign_key; int debug = model.Temp_debug; //partner_offer_id string partner_offer_id = partner_offer_id_pre.Trim() + model.Join_ID.ToString().Trim();//"TZ" + string source_url = model.Join_URL.Trim(); int region_code = model.Join_AreaCode; string title = model.Join_Title; string content = model.Join_Content; int info_role = model.Join_Type; string start_time = getUnix_timestamp(model.Join_StartTime); string expire_time = getUnix_timestamp(model.Join_EndTime); string contact_person = model.Join_LinkMan; if (contact_person_Temp.Trim() != "") { contact_person = contact_person_Temp; } string contact_phone1 = model.Join_Tel; if (contact_phone1_Temp.Trim() != "") { contact_phone1 = contact_phone1_Temp; } string contact_phone2 = ""; string contact_email = model.Join_Email; string postString = ""; postString = "category_id=" + category_id.ToString(); postString += "&contact_person=" + contact_person; postString += "&contact_phone1=" + contact_phone1; if (contact_phone2 != "") { postString += "&contact_phone2=" + contact_phone2; } if (contact_email != "") { postString += "&contact_email=" + contact_email; } postString += "&content=" + GetContent(content); postString += "&debug=" + debug; postString += "&expire_time=" + expire_time; postString += "&info_role=" + info_role; postString += "&partner_id=" + partner_id; postString += "&partner_offer_id=" + partner_offer_id; postString += "®ion_code=" + region_code; postString += "&sign_value=" + GetSign_value(partner_id, sign_key, category_id, partner_offer_id, source_url, region_code, title, content, info_role, start_time, expire_time, contact_email, contact_person, contact_phone1, contact_phone2, debug); postString += "&source_url=" + source_url; postString += "&start_time=" + start_time; postString += "&title=" + GetTitle(title); byte[] byteArray = Encoding.UTF8.GetBytes(postString); HttpWebRequest webRequest2 = (HttpWebRequest)WebRequest.Create("http://api.fuwu.koubei.com/offer/" + postType); webRequest2.Method = "POST"; webRequest2.ContentType = "application/x-www-form-urlencoded"; webRequest2.ContentLength = byteArray.Length; Stream newStream = webRequest2.GetRequestStream(); newStream.Write(byteArray, 0, byteArray.Length);//写入参数 newStream.Close(); HttpWebResponse response2 = (HttpWebResponse)webRequest2.GetResponse(); StreamReader sr2 = new StreamReader(response2.GetResponseStream(), Encoding.Default); string retStr = sr2.ReadToEnd(); string resultStr = dealInfoByRetStr(model.Join_ID, retStr); //return resultStr.ToString(); return(retStr); }