Esempio n. 1
0
 protected void dgSoleVenderDetail_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandName == "AddNew")
     {
         try
         {
             SoleVendorRequestDetail detail = new SoleVendorRequestDetail();
             detail.SoleVendorRequest = _presenter.CurrentSoleVendorRequest;
             DropDownList ddlItem = e.Item.FindControl("ddlFItemAcc") as DropDownList;
             detail.ItemAccount = _presenter.GetItemAccount(Convert.ToInt32(ddlItem.SelectedValue));
             TextBox txtItemDescription = e.Item.FindControl("txtFDescription") as TextBox;
             detail.ItemDescription = txtItemDescription.Text;
             TextBox txtQty = e.Item.FindControl("txtQty") as TextBox;
             detail.Qty = Convert.ToInt32(txtQty.Text);
             TextBox txtUnitCost = e.Item.FindControl("txtUnitCost") as TextBox;
             detail.UnitCost = Convert.ToDecimal(txtUnitCost.Text);
             TextBox txtTotalCost = e.Item.FindControl("txtTotalCost") as TextBox;
             detail.TotalCost = Convert.ToDecimal(txtTotalCost.Text);
             _presenter.CurrentSoleVendorRequest.SoleVendorRequestDetails.Add(detail);
             dgSoleVenderDetail.EditItemIndex = -1;
             // BindSoleVendorRequests();
             BindSoleVendorRequestDetails();
         }
         catch (Exception ex)
         {
             Master.ShowMessage(new AppMessage("Error: Unable to Update Bidder " + ex.Message, RMessageType.Error));
         }
     }
 }
Esempio n. 2
0
        protected void btnCreateSoleVendor_Click(object sender, EventArgs e)
        {
            try
            {
                _presenter.OnViewLoaded();
                btnSave.Visible = true;
                pnlInfo.Visible = false;
                _presenter.CurrentSoleVendorRequest.SoleVendorRequestDetails = new List <SoleVendorRequestDetail>();

                foreach (GridViewRow item in grvDetails.Rows)
                {
                    int prDetailID = (int)grvDetails.DataKeys[item.RowIndex].Value;
                    Session["prId"] = prDetailID;

                    if (item.RowType == DataControlRowType.DataRow)
                    {
                        CheckBox chk = (CheckBox)item.FindControl("chkSelect");
                        if (chk.Checked)
                        {
                            if (_presenter.GetPurchaseRequestDetail(prDetailID) != null)
                            {
                                PurchaseRequestDetail   PRDetail = _presenter.GetPurchaseRequestDetail(prDetailID);
                                SoleVendorRequestDetail svDetail = new SoleVendorRequestDetail();
                                svDetail.PRDetailID      = PRDetail.Id;
                                svDetail.ItemAccount     = PRDetail.ItemAccount;
                                svDetail.ItemDescription = PRDetail.ItemDescription;
                                svDetail.Qty             = PRDetail.ApprovedQuantity; //Make sure the approved quanity is the one to be used for purchase
                                svDetail.Project         = PRDetail.Project;
                                svDetail.Grant           = PRDetail.Grant;
                                _presenter.CurrentSoleVendorRequest.SoleVendorRequestDetails.Add(svDetail);
                                _presenter.CurrentSoleVendorRequest.PurchaseRequest = PRDetail.PurchaseRequest;
                                BindSoleVendorRequestDetails();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Add SoleVendor Item " + ex.Message, RMessageType.Error));
                ExceptionUtility.LogException(ex, ex.Source);
                ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
            }
        }
 public void DeleteSoleVendorRequestDetail(SoleVendorRequestDetail soleVendorRequestDetail)
 {
     _controller.DeleteEntity(soleVendorRequestDetail);
 }