using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using SysBaseLibs; namespace SysDataLibs.TableClass { public partial class Markets_info { public static string GetAllMarketIDByRegionId(string pcRegionID, UserSession poSession) { return GetAllMarketIDByRegionId(pcRegionID, poSession.DBConn); } public static string GetAllMarketIDByRegionId(string pcRegionID, DBConnSql poDBConn) { string lcRetVal = "''"; string lcRegionIds = Regions_info.GetAllRegion(poDBConn, pcRegionID); string lcSql = " select MarketId from markets where regionid in ( " + lcRegionIds + " ) "; rsQuery loQuery = poDBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0) { loQuery.MoveFirst(); for (int i = 0; i < loQuery.RecCount; i++) { lcRetVal += (lcRetVal == "" ? "" : ",") + "'" + loQuery.GetString("MarketId") + "'"; loQuery.MoveNext(); } } return lcRetVal; } /// /// 拿到该用户所属地区下的所有市场 /// /// /// /// /// public static rsQuery GetAllMarkets(string pcIsLock, Sys_Users_info poUser, DBConnSql poConn) { string lcSql = "select M.MarketID as MarketID ,M.Names as MarketName,R.Names as RegionName from Markets M,Regions R where M.RegionID=R.RegionId and M.IsLock='" + pcIsLock + "' "; string lcAllMarketId = GetAllMarketIDByRegionId(poUser.RegionID, poConn); if (poUser.IsMarketSys) lcSql += " and M.MarketID in ( " + lcAllMarketId + ") "; return poConn.OpenQuery(lcSql); } public static rsQuery GetMarketsByMarketIds(string pcMarkets, DBConnSql poConn) { string lcSql = "select M.MarketID as MarketID ,M.Names as MarketName,R.Names as RegionName from Markets M,Regions R where M.RegionID=R.RegionId and M.IsLock='0' "; if (pcMarkets.Trim().Length == 0) { lcSql += " and 1=2 "; } else { lcSql += " and M.MarketID in ( " + pcMarkets + " ) "; } return poConn.OpenQuery(lcSql); } public static void SetMarketsToList(ListControl poControl, rsQuery poQuery) { if (poQuery != null && poQuery.IsOpened && poQuery.RecCount > 0 && poControl != null) { poControl.Items.Clear(); poQuery.MoveFirst(); for (int i = 0; i < poQuery.RecCount; i++) { string lcId = poQuery.GetString("MarketID"); string lcName = poQuery.GetString("MarketName"); string lcType = poQuery.GetString("RegionName"); poControl.Items.Add(new ListItem(lcName + " (" + lcType + ")", lcId)); poQuery.MoveNext(); } } } // //------证件信息 // public static void PrintMarketWarrantInfo(HtmlTable poTable, string MarketID, UserSession poSession)//, string pcCurId) { if (poTable != null && MarketID.Trim().Length > 0 && poSession != null && poSession.DBConn != null) { string lcSql = "select * from " + Tn.MarketHasWarrant + " where " + MarketHasWarrant_info.cMarketID + "='" + MarketID + "'"; rsQuery loQuery = poSession.DBConn.OpenQuery(lcSql); HtmlTableRow loRow; HtmlTableCell loCell; string lcColor = ""; if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0) { //loQuery.SortBy("UpdateTime", false); loQuery.MoveFirst(); for (int i = 0; i < loQuery.RecCount; i++) { lcColor = "#ffffff"; loRow = new HtmlTableRow(); loRow.Height = "19"; loCell = new HtmlTableCell(); loCell.Attributes.Add("bgcolor", lcColor); loCell.Align = "center"; loCell.InnerText = (i + 1) + ""; loRow.Cells.Add(loCell); //证件类型 loCell = new HtmlTableCell(); string lcTitle = loQuery.GetString("WarrantTypeID"); WarrantType_info LTbl = new WarrantType_info(); string lcErrMsg = ""; lcSql = "select * from " + Tn.WarrantType + " where " + WarrantType_info.cWarrantTypeID + " =" + lcTitle + " "; SysDataLibs.AppEnv.GetTableInfo(lcSql, LTbl, poSession.DBConn, ref lcErrMsg); loCell.ColSpan = 2; loCell.Align = "center"; loCell.InnerText = LTbl.Name;//string.Format("
{1}
\n", loQuery.GetString("WarrantTypeID"), lcTitle); loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); loCell.Align = "center"; loCell.ColSpan = 2; loCell.InnerText = loQuery.GetString("WarrantNumber"); loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); loCell.Align = "center"; loCell.InnerText = string.Format("{0:d}", loQuery.GetDateTime("ValidStartTime")); loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); loCell.Align = "center"; loCell.InnerText = string.Format("{0:d}", loQuery.GetDateTime("ValidEndTime")); loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); string lcSql1 = "select * from Sys_AttachFiles where TableID= 'MarketHasWarrant' and ColumnID='ID' AND SourceKey='" + loQuery.GetString("ID") + "'"; rsQuery loQry = poSession.DBConn.OpenQuery(lcSql1); loCell = new HtmlTableCell(); loCell.Align = "center"; if (loQry != null && loQry.IsOpened && loQry.RecCount > 0) { Sys_AttachFiles_info loInfo = new Sys_AttachFiles_info(loQry.CurrentRow); loCell.InnerHtml = "下载"; } loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); poTable.Rows.Add(loRow); loQuery.MoveNext(); } } else { //行标题 loRow = new HtmlTableRow(); loCell = new HtmlTableCell(); lcColor = "#ffffff"; loRow.Height = "21"; loCell.Attributes.Add("bgcolor", lcColor); loCell.ColSpan = 5; loCell.Align = "center"; loCell.InnerText = "没有相关记录"; loRow.Cells.Add(loCell); // poTable.Rows.Add(loRow); } } } //信用评比情况 public static void PrintMarketCreditInfo(HtmlTable poTable, string pcMarketID, UserSession poSession) { if (poTable != null && pcMarketID.Trim().Length > 0 && poSession != null && poSession.DBConn != null) { //行标题 HtmlTableRow loRow = new HtmlTableRow(); HtmlTableCell loCell = new HtmlTableCell(); string lcColor = ""; //loRow.Height = "20"; //loCell.Attributes.Add("bgcolor", "#8caae7"); loCell.ColSpan = 8; loCell.Attributes.Add("class", "tdHeadTitleSmall"); loCell.Align = "center"; loCell.InnerHtml = "信用评比情况"; loRow.Cells.Add(loCell); // poTable.Rows.Add(loRow); //列标题 loRow = new HtmlTableRow(); loCell = new HtmlTableCell(); loCell.Attributes.Add("class", "tdTableHeader"); loCell.Align = "center"; loCell.InnerHtml = "序号"; loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); loCell.Attributes.Add("class", "tdTableHeader"); loCell.InnerHtml = "信誉等级"; loCell.ColSpan = 3; loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); loCell.Attributes.Add("class", "tdTableHeader"); loCell.ColSpan = 2; loCell.InnerHtml = "得分"; loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); loCell.ColSpan = 2; loCell.Attributes.Add("class", "tdTableHeader"); loCell.InnerHtml = "评级时间"; loRow.Cells.Add(loCell); // poTable.Rows.Add(loRow); //获取近两年的记录 string lcSql = "select * from " + Tn.vwMarketEvalRpt + " where " + vwMarketEvalRpt_info.cMarketId + "='" + pcMarketID + "' and " + vwMarketEvalRpt_info.cYear + "> '" + DateTime.Now.AddYears(-2).Year + "' order by Year Desc , Month desc "; rsQuery loQuery = poSession.DBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0) { //loQuery.SortBy(vwSellerEvalRpt_info.cValidEndTime, false); loQuery.MoveFirst(); for (int i = 0; i < loQuery.RecCount; i++) { lcColor = "#ffffff"; loRow = new HtmlTableRow(); loCell = new HtmlTableCell(); // loCell.Attributes.Add("class", "td2"); loCell.Align = "center"; loCell.InnerHtml = (i + 1) + ""; loRow.Cells.Add(loCell); // 信誉等级 loCell = new HtmlTableCell(); // loCell.Attributes.Add("class", "td2"); loCell.Align = "center"; loCell.ColSpan = 3; loCell.InnerHtml = MarketEvalGrade_info.GetRankByScore(loQuery.GetInt(vwMarketEvalRpt_info.cTotalScore)); loRow.Cells.Add(loCell); // 信誉分值 loCell = new HtmlTableCell(); // loCell.Attributes.Add("class", "td2"); loCell.Align = "center"; loCell.ColSpan = 2; loCell.InnerHtml = loQuery.GetInt(vwMarketEvalRpt_info.cTotalScore) + ""; loRow.Cells.Add(loCell); loCell = new HtmlTableCell(); // loCell.Attributes.Add("class", "td2"); loCell.ColSpan = 2; loCell.Align = "center"; loCell.InnerHtml = loQuery.GetString(vwMarketEvalRpt_info.cYear) + "年" + loQuery.GetString(vwMarketEvalRpt_info.cMonth) + "月"; loRow.Cells.Add(loCell); poTable.Rows.Add(loRow); loQuery.MoveNext(); } } else { //行标题 loRow = new HtmlTableRow(); loCell = new HtmlTableCell(); loCell.Attributes.Add("class", "td2"); loCell.ColSpan = 7; loCell.Align = "center"; loCell.InnerHtml = "没有相关记录"; loRow.Cells.Add(loCell); // poTable.Rows.Add(loRow); } } } //----------------------------- public static void PrintMarketImage(HtmlTable poTable, string MarketID, UserSession poSession)//, string pcCurId) { if (poTable != null && MarketID.Trim().Length > 0 && poSession != null && poSession.DBConn != null) { string lcSql = "select [ID] from MarketChart where MarketID ='" + MarketID + "'"; rsQuery loQuery = poSession.DBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0) { //loQuery.MoveFirst(); //for (int i = 0; i < loQuery.RecCount; i++) //{ string lcColor = "#8caae7"; HtmlTableRow loRow = new HtmlTableRow(); loRow.Height = "19"; HtmlTableCell loCell = new HtmlTableCell(); loCell.Attributes.Add("bgcolor", lcColor); loCell.Align = "center"; loCell.InnerHtml = "市场分布示意图"; loCell.ColSpan = 8; loRow.Cells.Add(loCell); //插入一行 poTable.Rows.Add(loRow); loRow = new HtmlTableRow(); loRow.Height = "380"; loCell = new HtmlTableCell(); loCell.ColSpan = 8; loCell.Align = "center"; string imgStr = ""; loCell.InnerHtml = imgStr;// "市场管理人员网络图" loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); //插入一行 poTable.Rows.Add(loRow); loRow = new HtmlTableRow(); loRow.Height = "19"; loCell = new HtmlTableCell(); loCell.Align = "center"; loCell.InnerHtml = "市场管理人员网络图";//string.Format("
{1}
\n", loQuery.GetString("WarrantTypeID"), lcTitle); loCell.Attributes.Add("bgcolor", lcColor); loCell.ColSpan = 8; loRow.Cells.Add(loCell); //插入一行 poTable.Rows.Add(loRow); loRow = new HtmlTableRow(); loRow.Height = "380"; loCell = new HtmlTableCell(); loCell.ColSpan = 8; loCell.Align = "center"; imgStr = ""; loCell.InnerHtml = imgStr;// "市场管理人员网络图" loCell.Attributes.Add("bgcolor", lcColor); loRow.Cells.Add(loCell); //插入一行 poTable.Rows.Add(loRow); //} } } } //----------------------------- } }