//更新操作 protected void List_RowUpdating(object sender, GridViewUpdateEventArgs e) { int itemId = Int32.Parse(List.DataKeys[e.RowIndex].Value.ToString()); string itemName = ((TextBox)List.Rows[e.RowIndex].FindControl("ItemNameBox")).Text.Trim(); if (itemName == "") { Utility.Alert(this, "商品名称未填写!"); return; } string itemType = ((DropDownList)List.Rows[e.RowIndex].FindControl("ItemTypeDropDown")).SelectedValue.ToString(); double itemPrice = Double.Parse(((TextBox)List.Rows[e.RowIndex].FindControl("ItemPriceBox")).Text.Trim()); DateTime itemBuyDate = DateTime.Parse(((TextBox)List.Rows[e.RowIndex].FindControl("ItemBuyDateBox")).Text.Trim() + " " + DateTime.Now.ToString("HH:mm:ss")); ItemEntity item = ItemAccess.GetItemListById(itemId); item.ItemID = itemId; item.ItemType = itemType; item.ItemName = itemName; item.ItemPrice = itemPrice; item.ItemBuyDate = itemBuyDate; item.Synchronize = 1; bool success = ItemAccess.UpdateItem(item, 1); if (success) { Session["TodayDate"] = itemBuyDate.ToString("yyyy-MM-dd"); List.EditIndex = -1; BindGrid(); } }
protected void PopulateControls() { string today = Session["TodayDate"].ToString(); int userId = Int32.Parse(Session["UserID"].ToString()); double priceMax = 0; DataTable dt = ItemAccess.GetBiJiaoFenXiList(today, userId, "chart", out priceMax); string max = "1"; string step = "1"; string catTypeName = ""; string itemPriceCur = ""; string itemPricePrev = ""; if (dt.Rows.Count > 0) { max = (priceMax > 0 ? Math.Floor(priceMax).ToString() : "1"); step = Math.Floor(Double.Parse(max) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { string dot = (i < dt.Rows.Count - 1 ? "," : ""); catTypeName += "{\"text\":\"" + dr["CategoryTypeName"].ToString() + "\",\"rotate\":0}" + dot; itemPriceCur += dr["ItemPriceCur"].ToString() + dot; itemPricePrev += dr["ItemPricePrev"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(catTypeName, itemPriceCur, itemPricePrev, max, step)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string key = ""; if (Request.QueryString["term"] != "" && Request.QueryString["term"] != null) { key = Request.QueryString["term"].Replace("%", ""); int userId = Int32.Parse(Session["UserID"].ToString()); StringBuilder items = new StringBuilder(); items.Append("["); DataTable dt = ItemAccess.GetItemNameListByKeywords(key, userId); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { items.Append("{"); items.Append("\"id\":" + "\"" + dr["ItemName"].ToString() + "\","); items.Append("\"label\":" + "\"" + dr["ItemName"].ToString() + "\""); items.Append("},"); } items.Remove(items.ToString().LastIndexOf(','), 1); } items.Append("]"); Response.Write(items.ToString()); Response.End(); } }
protected void PopulateControls() { string date = Session["TodayDate"].ToString(); int userId = Int32.Parse(Session["UserID"].ToString()); DataTable dt = ItemAccess.GetFenLeiZongJiList(date, userId); string value = ""; if (dt.Rows.Count > 0 && Double.Parse(dt.Rows[0]["ItemPriceTotal"].ToString()) > 0) { foreach (DataRow dr in dt.Rows) { if (Double.Parse(dr["ItemPriceTotal"].ToString()) > 0) { value += "{\"value\":" + dr["ItemPriceTotal"].ToString() + ",\"label\":\"" + dr["CategoryTypeName"].ToString() + "\",\"text\":\"" + dr["CategoryTypeName"].ToString() + "\"},"; } } value = value.Remove(value.Length - 1); } else { value = "{\"value\":100,\"label\":\"空记录\",\"text\":\"空记录\"}"; } Response.Write(GetChartJsonString(value)); Response.End(); }
protected void PopulateControls() { DataTable dt = ItemAccess.GetMonthList(today, userId); List.DataSource = dt; List.DataBind(); double zhichuPrice = 0; double shouruPrice = 0; double jiePrice = 0; double huanPrice = 0; foreach (DataRow dr in dt.Rows) { zhichuPrice += Double.Parse(dr["ZhiChuPrice"].ToString()); shouruPrice += Double.Parse(dr["ShouRuPrice"].ToString()); jiePrice -= Double.Parse(dr["JiePrice"].ToString()); huanPrice -= Double.Parse(dr["HuanPrice"].ToString()); } this.Label2.Text = zhichuPrice.ToString("0.0##"); this.Label3.Text = shouruPrice.ToString("0.0##"); this.Label4.Text = jiePrice.ToString("0.##"); this.Label5.Text = huanPrice.ToString("0.##"); }
protected void Page_Load(object sender, EventArgs e) { userId = Int32.Parse(Session["UserID"].ToString()); zhuanTiId = Int32.Parse(Request.QueryString["ztid"]); catTypeList = UserCategoryAccess.GetCategoryTypeList(userId); itemTypeList = ItemAccess.GetItemListType(); if (!IsPostBack) { BindGrid(); this.CatTypeEmpIns.DataSource = catTypeList; this.CatTypeEmpIns.DataTextField = "CategoryTypeName"; this.CatTypeEmpIns.DataValueField = "CategoryTypeID"; this.CatTypeEmpIns.DataBind(); if (Request.Cookies["CatTypeID"] != null) { this.CatTypeEmpIns.SelectedValue = Request.Cookies["CatTypeID"].Value; } this.ItemTypeEmpIns.DataSource = itemTypeList; this.ItemTypeEmpIns.DataTextField = "ItemTypeName"; this.ItemTypeEmpIns.DataValueField = "ItemTypeValue"; this.ItemTypeEmpIns.DataBind(); if (Session["TodayDate"] != null) { string today = Session["TodayDate"].ToString(); this.ItemBuyDateEmpIns.Text = today; } } }
protected void PopulateControls() { string itemName = ""; int userId = Int32.Parse(Session["UserID"].ToString()); if (Request.QueryString["term"] != null && Request.QueryString["term"] != "") { itemName = Request.QueryString["term"]; } DataTable dt = ItemAccess.GetItemPriceListByName(userId, itemName); StringBuilder items = new StringBuilder(); items.Append("["); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { items.Append("{\"label\":" + "\"" + Double.Parse(dr["ItemPrice"].ToString()).ToString("0.0##") + "\"},"); } items.Remove(items.ToString().LastIndexOf(','), 1); } items.Append("]"); Response.Write(items.ToString()); Response.End(); }
protected void PopulateControls() { int userId = Int32.Parse(Session["UserID"].ToString()); int notBuyMax = 0; int pageNumber = 1; int howManyItems = 0; DataTable dt = ItemAccess.GetTianShuFenXiList(userId, pageNumber, out howManyItems, out notBuyMax); string max = "1"; string step = "1"; string itemName = ""; string notBuy = ""; if (dt.Rows.Count > 0) { max = notBuyMax.ToString(); step = Math.Floor(Double.Parse(max) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { if (i == 15) { break; } string dot = (i < 15 - 1 && i < dt.Rows.Count - 1 ? "," : ""); itemName += "{\"text\":\"" + dr["ItemName"].ToString() + "\",\"rotate\":90}" + dot; notBuy += dr["NotBuy"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(itemName, notBuy, max, step)); Response.End(); }
protected void PopulateControls() { string today = Session["TodayDate"].ToString(); int userId = Int32.Parse(Session["UserID"].ToString()); int countMax = 0; DataTable dt = ItemAccess.GetItemNumTopList(today, userId, out countMax); string max = "1"; string step = "1"; string itemName = ""; string countNum = ""; if (dt.Rows.Count > 0) { max = countMax.ToString(); step = Math.Floor(Double.Parse(max) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { if (i == 15) { break; } string dot = (i < 15 - 1 && i < dt.Rows.Count - 1 ? "," : ""); itemName += "{\"text\":\"" + dr["ItemName"].ToString() + "\",\"rotate\":90}" + dot; countNum += dr["CountNum"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(itemName, countNum, max, step)); Response.End(); }
//删除操作 protected void List_RowDeleting(object sender, GridViewDeleteEventArgs e) { int itemId = Int32.Parse(List.DataKeys[e.RowIndex].Value.ToString()); int regionId = Int32.Parse(((HiddenField)List.Rows[e.RowIndex].FindControl("RegionIDHid")).Value); HiddenField itemTypeIdHid = (HiddenField)List.Rows[e.RowIndex].FindControl("ItemTypeIDHid"); HiddenField itemPriceHid = (HiddenField)List.Rows[e.RowIndex].FindControl("ItemPriceHid"); int monthRegion = 1; bool success = false; if (regionId > 0) { DataTable dt = ItemAccess.GetItemListByRegionId(userId, regionId); monthRegion = dt.Rows.Count; foreach (DataRow dr in dt.Rows) { itemId = Int32.Parse(dr["ItemID"].ToString()); success = ItemAccess.DeleteItem(itemId, userId); } } else { success = ItemAccess.DeleteItem(itemId, userId); } if (success) { List.EditIndex = -1; BindGrid(); } else { Utility.Alert(this, "删除失败!"); } }
protected void ManageUserAccess(string module, User user) { this.user = user; this.module = module; moduleAccess = UserAccess.GetUserAccessRightsForModuleItem(user, module); if (moduleAccess != null) { if (moduleAccess.Add == false) { btnNew.Enabled = false; } if (moduleAccess.Edit == false) { btnEdit.Enabled = false; } if (moduleAccess.Print == false) { btnPreview.Enabled = false; } if (moduleAccess.Delete == false) { btnDelete.Enabled = false; } } }
protected void PupolateControls() { int userId = 0; if (Request.QueryString["userId"] != "" && Request.QueryString["userId"] != null) { userId = Int32.Parse(Request.QueryString["userId"]); } UserList.DataSource = UserAccess.GetAdminUserListById(userId); UserList.DataBind(); OAuthList.DataSource = OAuthAccess.GetAdminOAuthList(userId); OAuthList.DataBind(); UserCategoryList.DataSource = UserCategoryAccess.GetAdminUserCategoryList(userId); UserCategoryList.DataBind(); ZhuanTiList.DataSource = ZhuanTiAccess.GetAdminZhuanTiList(userId); ZhuanTiList.DataBind(); CardList.DataSource = CardAccess.GetAdminCardList(userId); CardList.DataBind(); List.DataSource = ItemAccess.GetAdminItemListByUserId(userId); List.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["page"] != "" && Request.QueryString["page"] != null) { int pageNumber = Int32.Parse(Request.QueryString["page"]); int userId = Int32.Parse(Session["UserID"].ToString()); double priceMax = 0; int howManyItems = 0; StringBuilder items = new StringBuilder(); items.Append("["); DataTable dt = ItemAccess.GetJiaGeFenXiList(userId, pageNumber, out howManyItems, out priceMax); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { items.Append("{"); items.Append("\"RowNumber\":" + "\"" + dr["RowNumber"].ToString() + "\","); items.Append("\"ItemType\":" + "\"" + dr["ItemType"].ToString() + "\","); items.Append("\"ItemTypeValue\":" + "\"" + dr["ItemTypeValue"].ToString() + "\","); items.Append("\"ItemName\":" + "\"" + dr["ItemName"].ToString() + "\","); items.Append("\"ItemBuyDate\":" + "\"" + DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\","); items.Append("\"ItemPrice\":" + "\"" + Double.Parse(dr["ItemPrice"].ToString()).ToString("0.0##") + "\""); items.Append("},"); } items.Remove(items.ToString().LastIndexOf(','), 1); } items.Append("]"); Response.Write(items.ToString()); Response.End(); } }
protected void PopulateControls() { int catTypeId = 0; int userId = Int32.Parse(Session["UserID"].ToString()); if (Request.QueryString["term"] != null && Request.QueryString["term"] != "") { catTypeId = Int32.Parse(Request.QueryString["term"]); } DataTable dt = ItemAccess.GetItemNameListByCatTypeId(userId, catTypeId); StringBuilder items = new StringBuilder(); items.Append("["); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { items.Append("{\"label\":" + "\"" + dr["ItemName"].ToString() + "\"},"); } items.Remove(items.ToString().LastIndexOf(','), 1); } items.Append("]"); Response.Write(items.ToString()); Response.End(); }
protected void PopulateControls() { DataTable dt = ItemAccess.GetJieHuanFenXiList(userId, today, type); List.DataSource = dt; List.DataBind(); double zhichuPrice = 0; double shouruPrice = 0; double jieruPrice = 0; double huanchuPrice = 0; double jiechuPrice = 0; double huanruPrice = 0; foreach (DataRow dr in dt.Rows) { zhichuPrice += Double.Parse(dr["ZhiChuPrice"].ToString()); shouruPrice += Double.Parse(dr["ShouRuPrice"].ToString()); jiechuPrice += Double.Parse(dr["JieChuPrice"].ToString()); huanruPrice += Double.Parse(dr["HuanRuPrice"].ToString()); jieruPrice += Double.Parse(dr["JieRuPrice"].ToString()); huanchuPrice += Double.Parse(dr["HuanChuPrice"].ToString()); } this.Label2.Text = zhichuPrice.ToString("0.0##"); this.Label3.Text = shouruPrice.ToString("0.0##"); this.Label4.Text = jiechuPrice.ToString("0.##"); this.Label5.Text = huanruPrice.ToString("0.##"); this.Label6.Text = jieruPrice.ToString("0.##"); this.Label7.Text = huanchuPrice.ToString("0.##"); this.Label8.Text = (shouruPrice - zhichuPrice).ToString("0.0##"); this.Label9.Text = (jiechuPrice - huanruPrice).ToString("0.##"); this.Label10.Text = (jieruPrice - huanchuPrice).ToString("0.##"); }
protected void PopulateControls() { int userId = Int32.Parse(Session["UserID"].ToString()); DataTable dt = ItemAccess.GetQuJianTongJiList(userId); string value = ""; string itemName = ""; if (dt.Rows.Count > 0) { int i = 0; foreach (DataRow dr in dt.Rows) { DateTime d1 = DateTime.Parse(dr["ItemBuyDate"].ToString()); DateTime d2 = DateTime.Parse(dr["ItemBuyDateMax"].ToString()); string dot = (i < dt.Rows.Count - 1 ? "," : ""); value += "{\"left\":\"" + (Int32.Parse(d1.ToString("MM")) - 1) + "\",\"right\":" + (GetRegionDate(d1, d2) - 1) + ",\"tip\":\"区间 " + d1.ToString("yyyy-MM-dd") + "~" + d2.ToString("yyyy-MM-dd") + "\"}" + dot; itemName = "\"" + dr["ItemName"].ToString() + "\"," + itemName; i++; } itemName = itemName.Remove(itemName.Length - 1); } else { itemName = "\"0\""; } Response.Write(GetChartJsonString(value, itemName)); Response.End(); }
protected void BindGrid() { DataTable dt = ItemAccess.GetAdminItemList(); this.List.DataSource = dt; this.List.DataBind(); this.Label1.Text = "记录:" + dt.Rows.Count; }
//快速添加消费 protected void LinkButton1_Click(object sender, EventArgs e) { string itemName = this.ItemNameEmpIns.Text.Trim(); if (itemName == "") { Utility.Alert(this, "商品名称未填写!"); return; } string itemType = this.ItemTypeEmpIns.SelectedValue; int catTypeId = Int32.Parse(this.CatTypeEmpIns.SelectedValue); Response.Cookies["CatTypeID"].Value = catTypeId.ToString(); Response.Cookies["CatTypeID"].Expires = DateTime.MaxValue; string itemPrice = this.ItemPriceEmpIns.Text.Trim(); if (!ValidHelper.CheckDouble(itemPrice)) { Utility.Alert(this, "商品价格填写错误!"); return; } string itemBuyDateStr = this.ItemBuyDateEmpIns.Text; DateTime itemBuyDate = DateTime.Parse(itemBuyDateStr + " " + DateTime.Now.ToString("HH:mm:ss")); ItemEntity item = new ItemEntity(); item.ItemType = itemType; item.ItemName = itemName; item.CategoryTypeID = catTypeId; item.ItemPrice = Double.Parse(itemPrice); item.ItemBuyDate = itemBuyDate; item.UserID = userId; item.RegionID = 0; item.RegionType = ""; item.Synchronize = 1; item.ZhuanTiID = zhuanTiId; bool success = ItemAccess.InsertItem(item, 1); if (success) { Session["TodayDate"] = itemBuyDate.ToString("yyyy-MM-dd"); this.ItemNameEmpIns.Text = ""; this.ItemPriceEmpIns.Text = ""; List.EditIndex = -1; BindGrid(); } else { Utility.Alert(this, "添加失败!"); return; } }
protected void PopulateControls() { DataTable dt = ItemAccess.GetQuJianTongJiList(userId); List.DataSource = dt; List.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); }
//保存方法 protected int SaveItem() { string itemName = this.ItemNameEmpIns.Text.Trim(); if (itemName == "") { Utility.Alert(this, "商品名称未填写!"); return(2); } string itemType = this.ItemTypeEmpIns.SelectedValue; int catTypeId = Int32.Parse(this.CatTypeEmpIns.SelectedValue); Response.Cookies["CatTypeID"].Value = catTypeId.ToString(); Response.Cookies["CatTypeID"].Expires = DateTime.MaxValue; string itemPrice = this.ItemPriceEmpIns.Text.Trim(); if (!ValidHelper.CheckDouble(itemPrice)) { Utility.Alert(this, "商品价格填写错误!"); return(2); } DateTime itemBuyDate = DateTime.Parse(today + " " + DateTime.Now.ToString("HH:mm:ss")); int cardId = Int32.Parse(this.CardEmpIns.SelectedValue); Response.Cookies["CardID"].Value = cardId.ToString(); Response.Cookies["CardID"].Expires = DateTime.MaxValue; ItemEntity item = new ItemEntity(); item.ItemType = itemType; item.ItemName = itemName; item.CategoryTypeID = catTypeId; item.ItemPrice = Double.Parse(itemPrice); item.ItemBuyDate = itemBuyDate; item.UserID = userId; item.RegionID = 0; item.RegionType = ""; item.Synchronize = 1; item.CardID = cardId; bool success = ItemAccess.InsertItem(item, 1); if (success) { Session["TodayDate"] = itemBuyDate.ToString("yyyy-MM-dd"); return(1); } else { return(0); } }
protected void PopulateControls() { DataTable dt = ItemAccess.GetItemPriceTopList(today, userId); PriceTop.DataSource = dt; PriceTop.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); }
protected void PopulateControls() { int countMax = 0; DataTable dt = ItemAccess.GetItemNumTopList(today, userId, out countMax); NumTop.DataSource = dt; NumTop.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl"); }
protected void PopulateControls() { double priceMax = 0; DataTable dt = ItemAccess.GetFenLeiZongJiMingXiList(catTypeId, today, userId, out priceMax); List.DataSource = dt; List.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = ItemAccess.GetAdminItemListToday(); this.List.DataSource = dt; this.List.DataBind(); this.Label1.Text = "记录:" + dt.Rows.Count; } }
protected void PopulateControls() { double priceMax = 0; DataTable dt = ItemAccess.GetItemDateTopList(today, userId, "list", out priceMax); DateTop.DataSource = dt; DateTop.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); }
protected void PopulateControls() { int monthMax = 0; DataTable dt = ItemAccess.GetTuiJianFenXiList(userId, out monthMax); ItemList.DataSource = dt; ItemList.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); }
protected void PopulateControls() { double priceMax = 0; DataTable dt = ItemAccess.GetItemNumDetailList(itemName, itemType, userId, Int32.Parse(catTypeId), today, "list", out priceMax); List.DataSource = dt; List.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); }
protected void PopulateControls() { string title = Request.QueryString["title"]; string itemName = Request.QueryString["itemName"] ?? ""; string itemType = Request.QueryString["itemType"] ?? ""; string today = Session["TodayDate"].ToString(); string catTypeId = "0"; if (Request.QueryString["catTypeId"] != null && Request.QueryString["catTypeId"] != "") { catTypeId = Request.QueryString["catTypeId"]; } //比较分析明细进入使用 if (Request.QueryString["date"] != null && Request.QueryString["date"] != "") { if (ValidHelper.CheckDate(Request.QueryString["date"])) { today = Request.QueryString["date"]; } } int userId = Int32.Parse(Session["UserID"].ToString()); double priceMax = 0; DataTable dt = ItemAccess.GetItemNumDetailList(itemName, itemType, userId, Int32.Parse(catTypeId), today, "list", out priceMax); string max = "1"; string step = "1"; string itemNameValue = ""; string itemPrice = ""; if (dt.Rows.Count > 0) { max = Math.Ceiling(priceMax).ToString(); step = Math.Floor(Double.Parse(max) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { if (i == 15) { break; } string dot = (i < 15 - 1 && i < dt.Rows.Count - 1 ? "," : ""); itemNameValue += "{\"text\":\"" + DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\",\"rotate\":90}" + dot; itemPrice += dr["ItemPrice"].ToString() + dot; i++; } } else { itemNameValue = "{\"text\":\"0\"},{\"text\":\"1\"}"; } Response.Write(GetChartJsonString(itemNameValue, itemPrice, title, max, step)); Response.End(); }
protected void PopulateControls() { int pageNumber = 1; double priceMax = 0; DataTable dt = ItemAccess.GetJiaGeFenXiList(userId, pageNumber, out howManyItems, out priceMax); ItemList.DataSource = dt; ItemList.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl"); }
protected void PopulateControls() { int pageNumber = 1; double priceMax = 0; DataTable dt = ItemAccess.GetJiaGeFenXiMingXiList(itemName, itemType, userId, pageNumber, out howManyItems, out priceMax); List.DataSource = dt; List.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); }
private IEnumerable<Item> GetWorkFlowItems(int numberOfItems) { var currentUser = Context.User; var workFlowList = Context.ContentDatabase.WorkflowProvider.GetWorkflows(); var index = 0; var workFlowItems = new List<Item>(); foreach (var iwf in workFlowList) { WorkflowState[] wss = iwf.GetStates(); foreach (WorkflowState ws in wss) { var its = iwf.GetItems(ws.StateID); foreach (var workflowItemInState in its) { if (index != numberOfItems) { var i = Context.ContentDatabase.GetItem(workflowItemInState.ItemID); var isNotNull = Context.Workflow.GetWorkflow(i).GetState(i); if (isNotNull.IsNotNull()) { if (!isNotNull.FinalState) { var ia = new ItemAccess(i); if (ia.CanRead()) { workFlowItems.Add(i); index++; } } } } } } } return workFlowItems; }