protected void dgItemDetail_UpdateCommand(object source, DataGridCommandEventArgs e) { bidd = Session["bidder"] as Bidder; int id = (int)dgItemDetail.DataKeys[e.Item.ItemIndex]; Chai.WorkflowManagment.CoreDomain.Requests.BidderItemDetail detail = _presenter.CurrentBidAnalysisRequest.GetBidder(bidd.Id).GetBidderItemDetail(id); try { DropDownList ddlItem = e.Item.FindControl("ddlItemAcc") as DropDownList; detail.ItemAccount = _presenter.GetItemAccount(Convert.ToInt32(ddlItem.SelectedValue)); TextBox txtItemDescription = e.Item.FindControl("txtDescription") as TextBox; detail.ItemDescription = txtItemDescription.Text; TextBox txtQty = e.Item.FindControl("txtEdtQty") as TextBox; detail.Qty = Convert.ToInt32(txtQty.Text); TextBox txtUnitCost = e.Item.FindControl("txtEdtUnitCost") as TextBox; detail.UnitCost = Convert.ToDecimal(txtUnitCost.Text); TextBox txtTotalCost = e.Item.FindControl("txtEdtTotalCost") as TextBox; detail.TotalCost = Convert.ToDecimal(txtTotalCost.Text); txtTotal.Text = (_presenter.CurrentBidAnalysisRequest.TotalPrice).ToString(); bidd.BidderItemDetails.Add(detail); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to Add BidderItem " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); } }
protected void dgItemDetail_DeleteCommand(object source, DataGridCommandEventArgs e) { bidd = Session["bidd"] as Bidder; int id = (int)dgItemDetail.DataKeys[e.Item.ItemIndex]; Chai.WorkflowManagment.CoreDomain.Requests.BidderItemDetail bidderItem = _presenter.CurrentBidAnalysisRequest.GetBidder(bidd.Id).GetBidderItemDetail(id); try { _presenter.DeleteBidderItemDetail(bidderItem); BindItemDetails(); Master.ShowMessage(new AppMessage("Bidder Item was Removed Successfully", Chai.WorkflowManagment.Enums.RMessageType.Info)); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to delete Bidder Item. " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); } }