//
// DotNetNuke?- http://www.dotnetnuke.com
// Copyright (c) 2002-2017
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using GJPDbHelper;
using System.Data;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
namespace Modules.ARB_DSR_MOON
{
/// -----------------------------------------------------------------------------
/// <summary>
/// The ViewARB_DSR_MOON class displays the content
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
partial class ViewARB_DSR_MOON : PortalModuleBase, IActionable
{
#region "Event Handlers"
/// -----------------------------------------------------------------------------
/// <summary>
/// Page_Load runs when the control is loaded
/// </summary>
/// -----------------------------------------------------------------------------
protected void Page_Load(object sender, System.EventArgs e)
{
try
{
//DataTable moon1 = DbHelper.DAL.ExecuteDataSet("select [销售人员] as 销售人员,sum([总升数]) as 一月销售升数, sum([销售金额总价]) as 一月销售金额 from [suntest].[dbo].[view_17_summary] where RIGHT([出库时间],2)=01 group by 销售人员 ").Tables[0];
//C1GridView1.DataSource = moon1;
//C1GridView1.DataBind();
//DataTable moon1 = DbHelper.DAL.ExecuteDataSet("select a.销售人员 as 销售人员,a.一月销售升数 as 一月销售升数,a.一月销售金额 as 一月销售金额,b.二月销售升数 as 二月销售升数,b.二月销售金额 as 二月销售金额 from (select [销售人员] as 销售人员,sum([总升数]) as 一月销售升数, sum([销售金额总价]) as 一月销售金额 from [suntest].[dbo].[view_17_summary] where right([出库时间],2)=01 group by 销售人员) as a INNER JOIN (select [销售人员] as 销售人员,sum([总升数]) as 二月销售升数, sum([销售金额总价]) as 二月销售金额 from [suntest].[dbo].[view_17_summary] where right([出库时间],2)=02 group by 销售人员) as b on a.销售人员=b.销售人员").Tables[0];
//C1GridView1.DataSource = moon1;
//C1GridView1.DataBind();
DataTable moon1 = GJPDbHelper.DAL.ExecuteDataSet("SELECT [销售人员] as 销售人员,[一月销售升数] as 一月销售升数,[一月销售金额] as 一月销售金额 ,[二月销售升数] as 二月销售升数,[二月销售金额] as 二月销售金额,[三月销售升数] as 三月销售升数,[三月销售金额] as 三月销售金额,[四月销售升数]as 四月销售升数,[四月销售金额] as 四月销售金额,[五月销售升数] as 五月销售升数,[五月销售金额] as 五月销售金额,[六月销售升数] as 六月销售升数,[六月销售金额] as 六月销售金额,[七月销售升数] as 七月销售升数,[七月销售金额] as 七月销售金额,[八月销售升数] as 八月销售升数,[八月销售金额] as 八月销售金额,[九月销售升数] as 九月销售升数,[九月销售金额] as 九月销售金额,[十月销售升数] as 十月销售升数,[十月销售金额] as 十月销售金额,[十一月销售升数] as 十一月销售升数,[十一月销售金额] as 十一月销售金额,[十二月销售升数] as 十二月销售升数,[十二月销售金额] as 十二月销售金额 FROM [A8170101].[dbo].[view_2017_DSRmonth]").Tables[0];
C1GridView1.DataSource = moon1;
C1GridView1.DataBind();
//DataTable moon2 = DbHelper.DAL.ExecuteDataSet("select [销售人员] as 销售人员,sum([总升数]) as 二月销售升数, sum([销售金额总价]) as 二月销售金额 from [suntest].[dbo].[view_17_summary] where RIGHT([出库时间],2)=02 group by 销售人员 ").Tables[0];
//C1GridView1.DataSource = moon2;
//C1GridView1.DataBind();
}
catch (Exception exc)
{
//Module failed to load
Exceptions.ProcessModuleLoadException(this, exc);
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// lstContent_ItemDataBound runs when items are bound. Here the
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// -----------------------------------------------------------------------------
protected void lstContent_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
string strContent = "";
// add content to template
if (!string.IsNullOrEmpty((string)Settings["template"]))
{
strContent = (string)Settings["template"];
ArrayList objProperties = CBO.GetPropertyInfo(typeof(ARB_DSR_MOONInfo));
foreach (PropertyInfo objPropertyInfo in objProperties)
{
strContent = strContent.Replace("[" + objPropertyInfo.Name.ToUpper() + "]", Server.HtmlDecode(DataBinder.Eval(e.Item.DataItem, objPropertyInfo.Name).ToString()));
}
}
else
{
strContent = DataBinder.Eval(e.Item.DataItem, "Content").ToString();
}
// assign the content
Label lblContent = (Label)e.Item.FindControl("lblContent");
lblContent.Text = strContent;
}
#endregion
#region "Optional Interfaces"
/// -----------------------------------------------------------------------------
/// <summary>
/// Registers the module actions required for interfacing with the portal framework
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
public ModuleActionCollection ModuleActions
{
get
{
ModuleActionCollection Actions = new ModuleActionCollection();
Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.AddContent, this.LocalResourceFile),
ModuleActionType.AddContent, "", "add.gif", EditUrl(), false, DotNetNuke.Security.SecurityAccessLevel.Edit,
true, false);
return Actions;
}
}
#endregion
}
}