private bool CheckConsumption(ConsumptionInfo info) { var materials = KanColleClient.Current.Homeport.Materials; var slotItems = KanColleClient.Current.Homeport.Itemyard.SlotItems; return(this.CheckCount(info.BuildKit.Normal, materials.DevelopmentMaterials) && this.CheckCount(info.RemodelKit.Normal, materials.ImprovementMaterials) && this.CheckCount(info.ConsumeCount, slotItems.Values.Count(s => s.Info == info.ConsumeSlotItem && s.Level == 0 && s.RawData.api_locked == 0))); }
/// <summary> /// Makes the <see cref="IPawn"/> consume the specified object, specifying the amount. /// </summary> /// <param name="consumable">The object that the host should consume.</param> /// <param name="amount">The amount that was consumed.</param> /// <returns>Information about the consumption that took place, if successful; otherwise, <c>null</c>.</returns> public ConsumptionInfo?Consume(IConsumable consumable, float amount) { var cInfo = new ConsumptionInfo(consumable, amount, DateTime.Now); LastConsumed = cInfo; OnConsumed(new PawnConsumedEventArgs(this, cInfo)); return(cInfo); }
/// <summary> /// 初始化方法 /// </summary> private void Bind() { try { this.lblRBNO.Text = "RB0001"; this.btnRBCC.Text = "2015年项目预算"; FooterBarLayoutData.Items["lblAmount"].DefaultValue = "¥50.00"; ConsumptionInfo Consumptioninfo = new ConsumptionInfo(); DataTable rowTable = Consumptioninfo.GetConsumptioninfo(); if (rowTable.Rows.Count > 0) { rowTable.Columns.Add("RBCHECKED", typeof(System.Boolean)); rowTable.Columns.Add("ROW_NOTE", typeof(System.String)); rowTable.Columns.Add("ROW_DATE", typeof(System.String)); foreach (DataRow row in rowTable.Rows) { if (row["RB_NO"].ToString().Length <= 0) { row["RBCHECKED"] = false; } else { row["RBCHECKED"] = true; } if (row["RBROW_NOTE"].ToString().Length > 0) { row["ROW_NOTE"] = row["RBROW_NOTE"]; } else { row["ROW_NOTE"] = "无"; } row["ROW_DATE"] = Convert.ToDateTime(row["RBROW_DATE"]).ToShortDateString(); } this.GridView1.DataSource = rowTable; this.GridView1.DataBind(); foreach (GridViewRow rowItem in GridView1.Rows) { rowItem.Cell.Items["Check"].DefaultValue = true; } getAmount(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Bind方法 /// </summary> private void Bind() { try { ConsumptionInfo Consumptioninfo = new ConsumptionInfo(); DataTable table = Consumptioninfo.GetConsumptioninfo(); if (table.Rows.Count > 0) { this.GridView1.Rows.Clear(); table.Columns.Add("RBCHECKED", typeof(System.Boolean)); table.Columns.Add("ROW_NOTE", typeof(System.String)); table.Columns.Add("ROW_DATE", typeof(System.String)); foreach (DataRow row in table.Rows) { if (row["RB_NO"].ToString().Length <= 0) { row["RBCHECKED"] = false; } else { row["RBCHECKED"] = true; } if (row["RBROW_NOTE"].ToString().Length > 0) { row["ROW_NOTE"] = row["RBROW_NOTE"]; } else { row["ROW_NOTE"] = "无"; } row["ROW_DATE"] = Convert.ToDateTime(row["RBROW_DATE"]).ToShortDateString(); } this.GridView1.DataSource = table; this.GridView1.DataBind(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Get User Beer Comsuption Information /// </summary> /// <param name="userName"></param> /// <param name="beerId"></param> /// <returns></returns> public Response <ConsumptionInfo> GetConsumption(string userName, int beerId) { Response <ConsumptionInfo> response = new Response <ConsumptionInfo>(); DBDataReader jsonDataReader = new DBDataReader(); try { User_x_Beer consumption = jsonDataReader.GetConsumptionById(userName, beerId); if (consumption != null) { Beer beer = jsonDataReader.GetBeerById(beerId); ConsumptionInfo info = new ConsumptionInfo() { UserName = userName, BeerAlcoholPercentage = beer.AlcoholPercentage, BeerBrand = beer.Brand, BeerType = beer.Type, ConsumptionVolum = consumption.TotalConsumption }; response.Object = info; response.StatusCode = 200; response.Success = true; } else { response.Message = "Invalid UserName or Beer Id, Or Not exist information for this user-beer realtion"; response.StatusCode = 202; response.Success = false; } } catch (Exception) { //Log the Exception into SQL or Elastic Search or disk(Log4Net or Serilog) response.Message = "Error during the execution"; response.Success = false; response.StatusCode = 29; } return(response); }
public PawnConsumedEventArgs([NotNull] IPawn pawn, [NotNull] ConsumptionInfo consumption) { Pawn = pawn; Consumption = consumption; }
private void Bind() { try { //获取报销单信息 this.lblRBNO.Text = "RB0001"; this.lblRBCC.Text = "2015年项目预算"; this.lblRBUser.Text = "Demo"; int RB_STATE = 1; switch (RB_STATE) { case -1: string REASON = "报销不符合"; if (REASON.Length > 0) { txtRB_REASON.Text = REASON; } txtRB_REASON.Visible = true; lblRB_REASON1.Visible = true; GridView1.Top = 403; break; default: txtRB_REASON.Visible = false; lblRB_REASON1.Visible = false; GridView1.Top = 295; break; } switch (RB_STATE) { case 0: this.lblRBState.Text = "已创建(可编辑)"; break; case 1: this.lblRBState.Text = "已提交"; break; case 2: this.lblRBState.Text = "责任人已审核"; break; case 3: this.lblRBState.Text = "行政已审核"; break; case 4: this.lblRBState.Text = "财务已审核"; break; case -1: this.lblRBState.Text = "已拒绝"; break; } this.lblnote.Text = "无"; FooterBarLayoutData.Items["lblAmount"].DefaultValue = "¥250.00"; //获取报销行项 ConsumptionInfo Consumptioninfo = new ConsumptionInfo(); DataTable rbrowtable = Consumptioninfo.GetConsumptioninfo(); if (rbrowtable.Rows.Count > 0) { rbrowtable.Columns.Add("ROW_NOTE", typeof(System.String)); rbrowtable.Columns.Add("ROW_DATE", typeof(System.String)); foreach (DataRow row in rbrowtable.Rows) { if (row["RBROW_NOTE"].ToString().Length > 0) { row["ROW_NOTE"] = row["RBROW_NOTE"]; } row["ROW_DATE"] = Convert.ToDateTime(row["RBROW_DATE"]).ToShortDateString(); } this.GridView1.DataSource = rbrowtable; this.GridView1.DataBind(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 初始化方法 /// </summary> /// <remarks></remarks> private void Bind() { try { DataTable table = new DataTable(); switch (btnMode) { case 1: TextTabBar1.SelectItemIndex = 0; this.GridView1.Layout = "frmConsumptionLayout"; ConsumptionInfo Consumptioninfo = new ConsumptionInfo(); table = Consumptioninfo.GetConsumptioninfo(); break; case 2: TextTabBar1.SelectItemIndex = 1; this.GridView1.Layout = "frmRBlayout"; ReimbursementInfo ReimbursementInfo = new ReimbursementInfo(); table = ReimbursementInfo.GetRBinfo(); break; } if (table.Rows.Count > 0) { switch (btnMode) { case 1: table.Columns.Add("ROW_DATE", typeof(System.String)); table.Columns.Add("ROW_NOTE", typeof(System.String)); foreach (DataRow row in table.Rows) { if (row["RBROW_NOTE"].ToString().Length > 0) { row["ROW_NOTE"] = row["RBROW_NOTE"]; } else { row["ROW_NOTE"] = "无"; } row["ROW_DATE"] = Convert.ToDateTime(row["RBROW_DATE"]).ToShortDateString(); } break; case 2: table.Columns.Add("RB_COSTCENTERNAME", typeof(System.String)); table.Columns.Add("RBROW_AMOUNT_FORMAT", typeof(System.String)); table.Columns.Add("RBUSERDATE", typeof(System.String)); table.Columns.Add("NOTE", typeof(System.String)); foreach (DataRow row in table.Rows) { row["RB_COSTCENTERNAME"] = row["RB_COSTCENTER"] + " Demo"; row["RBROW_AMOUNT_FORMAT"] = "¥" + row["RBROW_AMOUNT"].ToString(); if (row["RB_NOTE"].ToString().Length > 0) { row["NOTE"] = "备注:" + row["RB_NOTE"]; } else { row["NOTE"] = "备注:"; } row["RBUSERDATE"] = Convert.ToDateTime(row["CREATEDATE"]).ToShortDateString(); } break; } //赋值GridView1数据 this.GridView1.DataSource = table; this.GridView1.DataBind(); } else { this.GridView1.Rows.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }