|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsRptPriceShip;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using DSWeb.DataAccess;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsRptPriceShipDAL
|
|
|
|
|
{
|
|
|
|
|
public class MsRptPriceShipDAL
|
|
|
|
|
{
|
|
|
|
|
static public string ds6YunJiaKu = System.Configuration.ConfigurationSettings.AppSettings["ds6YunJiaKu"].ToString();
|
|
|
|
|
|
|
|
|
|
#region 查询
|
|
|
|
|
static public List<MsRptPriceShip> GetDataList(string strCondition, string userid, string usercode, string companyid, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
string sSql = GetDataListSQL(strCondition, userid, usercode, companyid);
|
|
|
|
|
strSql.Append(sSql);
|
|
|
|
|
//
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by [运价编号]");
|
|
|
|
|
}
|
|
|
|
|
return SetData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public string GetDataListStr(string strCondition, string userid, string usercode, string companyid)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
string sSql = GetDataListSQL(strCondition, userid, usercode, companyid);
|
|
|
|
|
strSql.Append(sSql);
|
|
|
|
|
strSql.Append(" order by [运价编号]");//convert(INT,VOUNO)
|
|
|
|
|
return strSql.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public string GetDataListSQL(string strCondition, string userid, string usercode, string companyid)
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select *,isJiaSuo=(case when [加锁]=1 then '是' else '否' end),[运价编号] as GID from [" + ds6YunJiaKu + "].[dbo].[t_price_ship] where 1=1");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" and " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
return strSql.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsRptPriceShip> SetData(StringBuilder strSql)
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<MsRptPriceShip>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsRptPriceShip data = new MsRptPriceShip();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.运价编号 = (reader["运价编号"] == null ? 0 : Convert.ToInt32(reader["运价编号"]));//运价编号
|
|
|
|
|
data.船公司 = (reader["船公司"] == null ? "" : Convert.ToString(reader["船公司"]));//船公司
|
|
|
|
|
data.启运港 = (reader["启运港"] == null ? "" : Convert.ToString(reader["启运港"]));//启运港
|
|
|
|
|
data.目的港 = (reader["目的港"] == null ? "" : Convert.ToString(reader["目的港"]));//目的港
|
|
|
|
|
data.航线 = (reader["航线"] == null ? "" : Convert.ToString(reader["航线"]));//航线
|
|
|
|
|
data.全包底价1 = (reader["全包底价1"] == null ? "0" : Convert.ToString(reader["全包底价1"]));//全包底价1
|
|
|
|
|
data.全包底价2 = (reader["全包底价2"] == null ? "0" : Convert.ToString(reader["全包底价2"]));//全包底价2
|
|
|
|
|
data.全包底价3 = (reader["全包底价3"] == null ? "0" : Convert.ToString(reader["全包底价3"]));//全包底价3
|
|
|
|
|
data.全包底价4 = (reader["全包底价4"] == null ? "0" : Convert.ToString(reader["全包底价4"]));//全包底价4
|
|
|
|
|
data.全包底价5 = (reader["全包底价5"] == null ? "0" : Convert.ToString(reader["全包底价5"]));//全包底价5
|
|
|
|
|
data.全包底价6 = (reader["全包底价6"] == null ? "0" : Convert.ToString(reader["全包底价6"]));//全包底价6
|
|
|
|
|
data.全包底价7 = (reader["全包底价7"] == null ? "0" : Convert.ToString(reader["全包底价7"]));//全包底价7
|
|
|
|
|
data.全包底价8 = (reader["全包底价8"] == null ? "0" : Convert.ToString(reader["全包底价8"]));//全包底价8
|
|
|
|
|
data.底价构成1 = (reader["底价构成1"] == null ? "0" : Convert.ToString(reader["底价构成1"]));//底价构成1
|
|
|
|
|
data.底价构成2 = (reader["底价构成2"] == null ? "0" : Convert.ToString(reader["底价构成2"]));//底价构成2
|
|
|
|
|
data.底价构成3 = (reader["底价构成3"] == null ? "0" : Convert.ToString(reader["底价构成3"]));//底价构成3
|
|
|
|
|
data.底价构成4 = (reader["底价构成4"] == null ? "0" : Convert.ToString(reader["底价构成4"]));//底价构成4
|
|
|
|
|
data.底价构成5 = (reader["底价构成5"] == null ? "0" : Convert.ToString(reader["底价构成5"]));//底价构成5
|
|
|
|
|
data.底价构成6 = (reader["底价构成6"] == null ? "0" : Convert.ToString(reader["底价构成6"]));//底价构成6
|
|
|
|
|
data.底价构成7 = (reader["底价构成7"] == null ? "0" : Convert.ToString(reader["底价构成7"]));//底价构成7
|
|
|
|
|
data.底价构成8 = (reader["底价构成8"] == null ? "0" : Convert.ToString(reader["底价构成8"]));//底价构成8
|
|
|
|
|
data.一级售价1 = (reader["一级售价1"] == null ? "0" : Convert.ToString(reader["一级售价1"]));//一级售价1
|
|
|
|
|
data.一级售价2 = (reader["一级售价2"] == null ? "0" : Convert.ToString(reader["一级售价2"]));//一级售价2
|
|
|
|
|
data.一级售价3 = (reader["一级售价3"] == null ? "0" : Convert.ToString(reader["一级售价3"]));//一级售价3
|
|
|
|
|
data.一级售价4 = (reader["一级售价4"] == null ? "0" : Convert.ToString(reader["一级售价4"]));//一级售价4
|
|
|
|
|
data.一级售价5 = (reader["一级售价5"] == null ? "0" : Convert.ToString(reader["一级售价5"]));//一级售价5
|
|
|
|
|
data.一级售价6 = (reader["一级售价6"] == null ? "0" : Convert.ToString(reader["一级售价6"]));//一级售价6
|
|
|
|
|
data.一级售价7 = (reader["一级售价7"] == null ? "0" : Convert.ToString(reader["一级售价7"]));//一级售价7
|
|
|
|
|
data.一级售价8 = (reader["一级售价8"] == null ? "0" : Convert.ToString(reader["一级售价8"]));//一级售价8
|
|
|
|
|
data.二级售价1 = (reader["二级售价1"] == null ? "0" : Convert.ToString(reader["二级售价1"]));//二级售价1
|
|
|
|
|
data.二级售价2 = (reader["二级售价2"] == null ? "0" : Convert.ToString(reader["二级售价2"]));//二级售价2
|
|
|
|
|
data.二级售价3 = (reader["二级售价3"] == null ? "0" : Convert.ToString(reader["二级售价3"]));//二级售价3
|
|
|
|
|
data.二级售价4 = (reader["二级售价4"] == null ? "0" : Convert.ToString(reader["二级售价4"]));//二级售价4
|
|
|
|
|
data.二级售价5 = (reader["二级售价5"] == null ? "0" : Convert.ToString(reader["二级售价5"]));//二级售价5
|
|
|
|
|
data.二级售价6 = (reader["二级售价6"] == null ? "0" : Convert.ToString(reader["二级售价6"]));//二级售价6
|
|
|
|
|
data.二级售价7 = (reader["二级售价7"] == null ? "0" : Convert.ToString(reader["二级售价7"]));//二级售价7
|
|
|
|
|
data.二级售价8 = (reader["二级售价8"] == null ? "0" : Convert.ToString(reader["二级售价8"]));//二级售价8
|
|
|
|
|
data.三级售价1 = (reader["三级售价1"] == null ? "0" : Convert.ToString(reader["三级售价1"]));//三级售价1
|
|
|
|
|
data.三级售价2 = (reader["三级售价2"] == null ? "0" : Convert.ToString(reader["三级售价2"]));//三级售价2
|
|
|
|
|
data.三级售价3 = (reader["三级售价3"] == null ? "0" : Convert.ToString(reader["三级售价3"]));//三级售价3
|
|
|
|
|
data.三级售价4 = (reader["三级售价4"] == null ? "0" : Convert.ToString(reader["三级售价4"]));//三级售价4
|
|
|
|
|
data.三级售价5 = (reader["三级售价5"] == null ? "0" : Convert.ToString(reader["三级售价5"]));//三级售价5
|
|
|
|
|
data.三级售价6 = (reader["三级售价6"] == null ? "0" : Convert.ToString(reader["三级售价6"]));//三级售价6
|
|
|
|
|
data.三级售价7 = (reader["三级售价7"] == null ? "0" : Convert.ToString(reader["三级售价7"]));//三级售价7
|
|
|
|
|
data.三级售价8 = (reader["三级售价8"] == null ? "0" : Convert.ToString(reader["三级售价8"]));//三级售价8
|
|
|
|
|
data.卖价说明 = (reader["卖价说明"] == null ? "" : Convert.ToString(reader["卖价说明"]));//卖价说明
|
|
|
|
|
data.结关时间 = (reader["结关时间"] == null ? "" : Convert.ToString(reader["结关时间"]));//结关时间
|
|
|
|
|
data.开航时间 = (reader["开航时间"] == null ? "" : Convert.ToString(reader["开航时间"]));//开航时间
|
|
|
|
|
data.航行天数 = (reader["航行天数"] == null ? "" : Convert.ToString(reader["航行天数"]));//航行天数
|
|
|
|
|
data.合约编号 = (reader["合约编号"] == null ? "" : Convert.ToString(reader["合约编号"]));//合约编号
|
|
|
|
|
data.生效日期 = Convert.ToDateTime(reader["生效日期"]);//生效日期
|
|
|
|
|
data.有效日期 = Convert.ToDateTime(reader["有效日期"]);//有效日期
|
|
|
|
|
data.录入人 = (reader["录入人"] == null ? "" : Convert.ToString(reader["录入人"]));//录入人
|
|
|
|
|
data.录入日期 = Convert.ToDateTime(reader["录入日期"]);//录入日期
|
|
|
|
|
data.修改人 = (reader["修改人"] == null ? "" : Convert.ToString(reader["修改人"]));//修改人
|
|
|
|
|
data.备注 = (reader["备注"] == null ? "" : Convert.ToString(reader["备注"]));//备注
|
|
|
|
|
data.目的港中文 = (reader["目的港中文"] == null ? "" : Convert.ToString(reader["目的港中文"]));//目的港中文
|
|
|
|
|
data.加锁 = (reader["加锁"] == null ? false : Convert.ToBoolean(reader["加锁"]));//加锁
|
|
|
|
|
data.中转港 = (reader["中转港"] == null ? "" : Convert.ToString(reader["中转港"]));//中转港
|
|
|
|
|
data.周次 = (reader["周次"] == null ? 0 : Convert.ToInt32(reader["周次"]));//周次
|
|
|
|
|
data.年代 = (reader["年代"] == null ? 0 : Convert.ToInt32(reader["年代"]));//年代
|
|
|
|
|
data.O999 = (reader["O999"] == null ? "" : Convert.ToString(reader["O999"]));//O999
|
|
|
|
|
data.O998 = (reader["O998"] == null ? "" : Convert.ToString(reader["O998"]));//O998
|
|
|
|
|
data.其他费用1 = (reader["其他费用1"] == null ? "" : Convert.ToString(reader["其他费用1"]));//其他费用1
|
|
|
|
|
data.其他费用2 = (reader["其他费用2"] == null ? "" : Convert.ToString(reader["其他费用2"]));//其他费用2
|
|
|
|
|
data.其他费用3 = (reader["其他费用3"] == null ? "" : Convert.ToString(reader["其他费用3"]));//其他费用3
|
|
|
|
|
data.其他费用4 = (reader["其他费用4"] == null ? "" : Convert.ToString(reader["其他费用4"]));//其他费用4
|
|
|
|
|
data.其他费用5 = (reader["其他费用5"] == null ? "" : Convert.ToString(reader["其他费用5"]));//其他费用5
|
|
|
|
|
data.其他费用6 = (reader["其他费用6"] == null ? "" : Convert.ToString(reader["其他费用6"]));//其他费用6
|
|
|
|
|
//data.其他费用7 = (reader["其他费用7"] == null ? "" : Convert.ToString(reader["其他费用7"]));//其他费用7(晨星的运价库中无此字段,但是李工机器上的数据库中有,因此暂时屏蔽)
|
|
|
|
|
data.isJiaSuo = (reader["isJiaSuo"] == null ? "" : Convert.ToString(reader["isJiaSuo"]));
|
|
|
|
|
data.GID = (reader["GID"] == null ? 0 : Convert.ToInt32(reader["GID"]));//运价编号
|
|
|
|
|
#endregion
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 取其他费用权限_循环列
|
|
|
|
|
static public List<XiaLaKuangModel> GetFeeName(string strSHOWNAME)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select [fremark] as [VALUE],[fvalue] as [NAME],'' as CodeAndName from [" + ds6YunJiaKu + "].[dbo].[t_yj_param] where [fvalue] is not null and [fvalue]<>'' and [fremark] like '其他费用%' order by [fid]");
|
|
|
|
|
return SetXiaLaKuang(strSql, false);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 取集装箱权限_循环列
|
|
|
|
|
static public List<XiaLaKuangModel> GetCtn(string strSHOWNAME)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select [VALUE],[NAME],'' as CodeAndName from("
|
|
|
|
|
+ "select 1 as [VALUE],[运价箱型1] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型1] is not null and [运价箱型1]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 2 as [VALUE],[运价箱型2] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型2] is not null and [运价箱型2]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 3 as [VALUE],[运价箱型3] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型3] is not null and [运价箱型3]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 4 as [VALUE],[运价箱型4] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型4] is not null and [运价箱型4]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 5 as [VALUE],[运价箱型5] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型5] is not null and [运价箱型5]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 6 as [VALUE],[运价箱型6] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型6] is not null and [运价箱型6]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 7 as [VALUE],[运价箱型7] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型7] is not null and [运价箱型7]<>''"
|
|
|
|
|
+ " union "
|
|
|
|
|
+ "select 8 as [VALUE],[运价箱型8] as [NAME] from [" + ds6YunJiaKu + "].[dbo].[t_code_price_ctn] where [运价箱型8] is not null and [运价箱型8]<>''"
|
|
|
|
|
+ ") ctn order by [VALUE]");
|
|
|
|
|
return SetXiaLaKuang(strSql, false);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 取报价权限_循环列
|
|
|
|
|
static public List<XiaLaKuangModel> GetBaoJia(string strSHOWNAME)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select [VALUE]=(select top 1 (case when [fremark]='运价1' then '全包底价' when [fremark]='运价2' then '底价构成' when [fremark]='运价3' then '一级售价' when [fremark]='运价4' then '二级售价' when [fremark]='运价5' then '三级售价' else [fremark] end) as [fremark] from [" + ds6YunJiaKu + "].[dbo].[t_yj_param] where [fvalue]=[" + ds6YunJiaKu + "].[dbo].[t_sys_code_emp].[二级模块]),[二级模块] as [NAME],'' as CodeAndName from [" + ds6YunJiaKu + "].[dbo].[t_sys_code_emp] where [人员]='" + strSHOWNAME + "' and [一级模块]='运价查看' group by [二级模块],[权限代码] order by [权限代码]");
|
|
|
|
|
return SetXiaLaKuang(strSql, false);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 启运港,国内港口_下拉框
|
|
|
|
|
static public List<XiaLaKuangModel> GetCodeLoaportList()
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
//strSql.Append("SELECT [英文名] as [VALUE],[中文名] as [NAME],([英文名]+' | '+[中文名]) as CodeAndName FROM [" + ds6YunJiaKu + "].[dbo].[t_code_loaport] order by [英文名]");
|
|
|
|
|
strSql.Append("SELECT [启运港] as [VALUE],[启运港] as [NAME],[启运港] as CodeAndName FROM [" + ds6YunJiaKu + "].[dbo].[t_price_ship] order by [启运港]");
|
|
|
|
|
return SetXiaLaKuang(strSql, true);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 目的港,国外港口_下拉框
|
|
|
|
|
static public List<XiaLaKuangModel> GetCodeDisportList()
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
//strSql.Append("SELECT [英文名] as [VALUE],[中文名] as [NAME],([英文名]+' | '+[中文名]) as CodeAndName FROM [" + ds6YunJiaKu + "].[dbo].[t_code_disport] where [英文名] is not null and [英文名]<>'' order by [英文名]");
|
|
|
|
|
strSql.Append("select [目的港] as [VALUE],[目的港中文] as [NAME],([目的港]+' | '+[目的港中文]) as CodeAndName from [" + ds6YunJiaKu + "].[dbo].[t_price_ship] group by [目的港],[目的港中文] order by [目的港],[目的港中文]");
|
|
|
|
|
return SetXiaLaKuang(strSql, true);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 船公司_下拉框
|
|
|
|
|
static public List<XiaLaKuangModel> GetCrmClientList()
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
//strSql.Append("SELECT [代码] as [VALUE],[客户简称] as [NAME],([代码]+' | '+[客户简称]) as CodeAndName FROM [" + ds6YunJiaKu + "].[dbo].[t_crm_client] where [客户性质]='船' order by [代码]");
|
|
|
|
|
strSql.Append("select [船公司] as [VALUE],[船公司] as [NAME],[船公司] as CodeAndName from [" + ds6YunJiaKu + "].[dbo].[t_price_ship] group by [船公司] order by [船公司]");
|
|
|
|
|
return SetXiaLaKuang(strSql, true);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 航线_下拉框
|
|
|
|
|
static public List<XiaLaKuangModel> GetCodeTradeList()
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
//strSql.Append("SELECT [航线代码] as [VALUE],[航线] as [NAME],([航线代码]+' | '+[航线]) as CodeAndName FROM [" + ds6YunJiaKu + "].[dbo].[t_code_trade] order by [航线代码]");
|
|
|
|
|
strSql.Append("SELECT [航线] as [VALUE],[航线] as [NAME],[航线] as CodeAndName FROM [" + ds6YunJiaKu + "].[dbo].[t_price_ship] order by [航线]");
|
|
|
|
|
return SetXiaLaKuang(strSql, true);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 下拉框实体类
|
|
|
|
|
private static List<XiaLaKuangModel> SetXiaLaKuang(StringBuilder strSql,bool isNull)
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<XiaLaKuangModel>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
XiaLaKuangModel data = new XiaLaKuangModel();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.VALUE = (reader["VALUE"] == null ? "" : Convert.ToString(reader["VALUE"]).Trim());//列名
|
|
|
|
|
data.NAME = (reader["NAME"] == null ? "" : Convert.ToString(reader["NAME"]).Trim());//标题
|
|
|
|
|
data.CodeAndName = (reader["CodeAndName"] == null ? "" : Convert.ToString(reader["CodeAndName"]).Trim());//VALUE | NAME
|
|
|
|
|
#endregion
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isNull)
|
|
|
|
|
{
|
|
|
|
|
XiaLaKuangModel data2 = new XiaLaKuangModel();
|
|
|
|
|
data2.VALUE = "";//列名
|
|
|
|
|
data2.NAME = "";//标题
|
|
|
|
|
data2.CodeAndName = "";//VALUE | NAME
|
|
|
|
|
headList.Add(data2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取当前年、周
|
|
|
|
|
static public String GetData(string strUserID)
|
|
|
|
|
{
|
|
|
|
|
string strYear = DateTime.Now.Year.ToString();
|
|
|
|
|
|
|
|
|
|
#region 获取当年周数
|
|
|
|
|
var dt = DateTime.Now;
|
|
|
|
|
//找到今年的第一天是周几
|
|
|
|
|
int firstWeekend = Convert.ToInt32(DateTime.Parse(dt.Year + "-1-1").DayOfWeek);
|
|
|
|
|
//获取第一周的差额,如果是周日,则firstWeekend为0,第一周也就是从周天开始的。
|
|
|
|
|
int weekDay = firstWeekend == 0 ? 1 : (7 - firstWeekend + 1);
|
|
|
|
|
//获取今天是一年当中的第几天
|
|
|
|
|
int currentDay = dt.DayOfYear;
|
|
|
|
|
//(今天 减去 第一周周末)/7 等于 距第一周有多少周 再加上第一周的1 就是今天是今年的第几周了
|
|
|
|
|
//刚好考虑了惟一的特殊情况就是,今天刚好在第一周内,那么距第一周就是0 再加上第一周的1 最后还是1
|
|
|
|
|
int current_week = Convert.ToInt32(Math.Ceiling((currentDay - weekDay) / 7.0)) + 1;
|
|
|
|
|
#endregion
|
|
|
|
|
string strWeek = current_week.ToString();
|
|
|
|
|
|
|
|
|
|
return strYear + "&" + strWeek;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
}
|