protected void dgBidders_ItemCommand1(object source, DataGridCommandEventArgs e) { Chai.WorkflowManagment.CoreDomain.Requests.Bidder bidder = new Chai.WorkflowManagment.CoreDomain.Requests.Bidder(); if (e.CommandName == "AddNew") { try { DropDownList ddlSupplierType = e.Item.FindControl("ddlFSupplierType") as DropDownList; bidder.SupplierType = _presenter.GetSupplierType(Convert.ToInt32(ddlSupplierType.SelectedValue)); DropDownList ddlSupplier = e.Item.FindControl("ddlFSupplier") as DropDownList; bidder.Supplier = _presenter.GetSupplier(Convert.ToInt32(ddlSupplier.SelectedValue)); TextBox txtFLeadTimefromSupplier = e.Item.FindControl("txtFLeadTimefromSupplier") as TextBox; bidder.LeadTimefromSupplier = txtFLeadTimefromSupplier.Text; TextBox txtFContactDetails = e.Item.FindControl("txtFContactDetails") as TextBox; bidder.ContactDetails = txtFContactDetails.Text; TextBox txtFSpecialTermsDelivery = e.Item.FindControl("txtFSpecialTermsDeliveryy") as TextBox; bidder.SpecialTermsDelivery = txtFSpecialTermsDelivery.Text; TextBox txtFRank = e.Item.FindControl("txtFRank") as TextBox; bidder.Rank = Convert.ToInt32(txtFRank.Text); _presenter.CurrentBidAnalysisRequest.Bidders.Add(bidder); Master.ShowMessage(new AppMessage("Bidder Detail Successfully Added", RMessageType.Info)); dgBidders.EditItemIndex = -1; BindBidder(); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to Add Bidder " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); } } }
//protected void dgBidders_ItemCommand(object source, DataGridCommandEventArgs e) //{ // Chai.WorkflowManagment.CoreDomain.Requests.Bidder bidder = new Chai.WorkflowManagment.CoreDomain.Requests.Bidder(); // if (e.CommandName == "AddNew") // { // try // { // DropDownList ddlSupplierType = e.Item.FindControl("ddlFSupplierType") as DropDownList; // bidder.SupplierType = _presenter.GetSupplierType(Convert.ToInt32(ddlSupplierType.SelectedValue)); // DropDownList ddlSupplier = e.Item.FindControl("ddlFSupplier") as DropDownList; // bidder.Supplier = _presenter.GetSupplier(Convert.ToInt32(ddlSupplier.SelectedValue)); // TextBox txtFLeadTimefromSupplier = e.Item.FindControl("txtFLeadTimefromSupplier") as TextBox; // bidder.LeadTimefromSupplier = txtFLeadTimefromSupplier.Text; // TextBox txtFContactDetails = e.Item.FindControl("txtFContactDetails") as TextBox; // bidder.ContactDetails = txtFContactDetails.Text; // TextBox txtFSpecialTermsDelivery = e.Item.FindControl("txtFSpecialTermsDeliveryy") as TextBox; // bidder.SpecialTermsDelivery = txtFSpecialTermsDelivery.Text; // TextBox txtFRank = e.Item.FindControl("txtFRank") as TextBox; // bidder.Rank = Convert.ToInt32(txtFRank.Text); // _presenter.CurrentBidAnalysisRequest.Bidders.Add(bidder); // dgBidders.EditItemIndex = -1; // BindBidder(); // } // catch (Exception ex) // { // Master.ShowMessage(new AppMessage("Error: Unable to Add Bidder " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); // } // } //} protected void dgBidders_UpdateCommand(object source, DataGridCommandEventArgs e) { int id = (int)dgBidders.DataKeys[e.Item.ItemIndex]; Chai.WorkflowManagment.CoreDomain.Requests.Bidder bidder = _presenter.CurrentBidAnalysisRequest.GetBidder(id); try { DropDownList ddlSupplierType = e.Item.FindControl("ddlSupplierType") as DropDownList; bidder.SupplierType = _presenter.GetSupplierType(Convert.ToInt32(ddlSupplierType.SelectedValue)); DropDownList ddlSupplier = e.Item.FindControl("ddlSupplier") as DropDownList; bidder.Supplier = _presenter.GetSupplier(Convert.ToInt32(ddlSupplier.SelectedValue)); TextBox txtFLeadTimefromSupplier = e.Item.FindControl("txtLeadTimefromSupplier") as TextBox; bidder.LeadTimefromSupplier = txtFLeadTimefromSupplier.Text; TextBox txtContactDetails = e.Item.FindControl("txtContactDetails") as TextBox; bidder.ContactDetails = txtContactDetails.Text; TextBox txtSpecialTermsDelivery = e.Item.FindControl("txtSpecialTermsDelivery") as TextBox; bidder.SpecialTermsDelivery = txtSpecialTermsDelivery.Text; TextBox txtFRank = e.Item.FindControl("txtRank") as TextBox; bidder.Rank = Convert.ToInt32(txtFRank.Text); dgBidders.EditItemIndex = -1; BindBidder(); Master.ShowMessage(new AppMessage("Bidder Detail Successfully Updated", RMessageType.Info)); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to Update Bidder " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); } }
protected void dgBidders_DeleteCommand1(object source, DataGridCommandEventArgs e) { int id = (int)dgBidders.DataKeys[e.Item.ItemIndex]; Chai.WorkflowManagment.CoreDomain.Requests.Bidder bidder = _presenter.CurrentBidAnalysisRequest.GetBidder(id); try { _presenter.DeleteBidder(bidder); BindBidder(); Master.ShowMessage(new AppMessage("Bidder was Removed Successfully", Chai.WorkflowManagment.Enums.RMessageType.Info)); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to delete Bidder. " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); } }