📄 stockmanage.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Common;
using PowerEasy.Controls;
using PowerEasy.Model.Shop;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
public class StockManage : AdminPage
{
protected Button BtnDelete;
protected ExtendedGridView EgvStock;
protected ExtendedGridView EgvStockItem;
protected Label LblTitle;
private decimal m_TotalMoney;
protected ObjectDataSource ObsStock;
protected ProductManageNavigation Pmn;
protected Panel PnlStockItem;
protected ScriptManager ScriptManager1;
protected ExtendedSiteMapPath SmpNavigator;
protected System.Web.UI.UpdatePanel UpdatePanel1;
protected System.Web.UI.UpdatePanel UpdatePanel2;
protected void BtnDelete_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.EgvStock.SelectList.ToString()))
{
AdminPage.WriteErrMsg("请选择要删除的记录!");
}
else
{
this.DeleteStock(this.EgvStock.SelectList.ToString());
}
}
private void DeleteStock(string idList)
{
if (PowerEasy.Shop.StockManage.Delete(idList))
{
AdminPage.WriteSuccessMsg("删除成功!", "StockManage.aspx");
}
else
{
AdminPage.WriteErrMsg("删除失败!");
}
}
protected void EgvStock_RowCommand(object sender, CommandEventArgs e)
{
string str;
if (((str = e.CommandName) != null) && (str == "View"))
{
this.UpdatePanel1.Visible = true;
string[] strArray = e.CommandArgument.ToString().Split(new char[] { '|' });
int stockId = DataConverter.CLng(strArray[0]);
this.PnlStockItem.Visible = true;
this.LblTitle.Text = ((strArray[1] == "InStock") ? "入库单 " : "出库单 ") + strArray[2] + " 明细";
this.EgvStockItem.DataSource = StockItem.GetListByStockId(stockId);
this.EgvStockItem.DataBind();
}
else
{
this.UpdatePanel1.Visible = false;
}
}
protected void EgvStock_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
PowerEasy.Shop.StockManage.Delete(e.Keys["StockId"].ToString());
this.EgvStock.DataBind();
this.PnlStockItem.Visible = false;
}
protected void EgvStockItem_DataBound(object sender, EventArgs e)
{
if (this.EgvStockItem.Rows.Count > 0)
{
GridViewRow footerRow = this.EgvStockItem.FooterRow;
footerRow.CssClass = this.EgvStockItem.RowStyle.CssClass;
footerRow.HorizontalAlign = HorizontalAlign.Right;
while (footerRow.Cells.Count != 2)
{
footerRow.Cells.RemoveAt(0);
}
footerRow.Cells[0].ColumnSpan = 5;
footerRow.Cells[0].Text = "<b>合 计:</b>";
footerRow.Cells[1].Text = this.m_TotalMoney.ToString("0.00");
}
else
{
this.BtnDelete.Enabled = false;
}
}
protected void EgvStockItem_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
StockItemInfo dataItem = e.Row.DataItem as StockItemInfo;
Label label = e.Row.FindControl("LblMoney") as Label;
Label label2 = e.Row.FindControl("LblProductName") as Label;
if (label != null)
{
decimal num = dataItem.Amount * dataItem.Price;
label.Text = num.ToString("0.00");
this.m_TotalMoney += num;
}
if (label2 != null)
{
if (!string.IsNullOrEmpty(dataItem.Property))
{
label2.Text = dataItem.ProductName + "(" + dataItem.Property + ")";
}
else if (string.IsNullOrEmpty(dataItem.TableName))
{
label2.Text = dataItem.ProductName + "(促销)";
}
else
{
label2.Text = dataItem.ProductName;
}
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
this.EgvStock.PageSize = 15;
}
int num = BasePage.RequestInt32("SearchType");
string str = BasePage.RequestString("KeyWord");
switch (num)
{
case 0:
this.SmpNavigator.AdditionalNode = "所有单据记录";
return;
case 1:
this.SmpNavigator.AdditionalNode = "所有入库单";
return;
case 2:
this.SmpNavigator.AdditionalNode = "所有出库单";
return;
case 3:
this.SmpNavigator.AdditionalNode = "单据编号是 " + str + "的有:";
return;
case 4:
this.SmpNavigator.AdditionalNode = "录入者是 " + str + "的单据有:";
return;
case 5:
this.SmpNavigator.AdditionalNode = "录入日期是 " + str + "的单据有:";
return;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -