protected void ChangeCollectionPointBtn_Click(object sender, EventArgs e)
 {
     try
     {
         int newcpid = Int32.Parse(CollectionPointRbtnl.SelectedValue);
         if (CurrentCollectionPointLbl.Text == DisbursementLogic.GetCurrentCPWithTimeByID(newcpid))
         {
             statusMessage.Text      = "The Collection Point is already " + CurrentCollectionPointLbl.Text;
             statusMessage.Visible   = true;
             statusMessage.ForeColor = Color.Red;
         }
         else
         {
             DisbursementLogic.UpdateCollectionPoint(DisbursementLogic.GetCurrentDep(), newcpid);
             CurrentCollectionPointLbl.Text   = DisbursementLogic.GetCurrentCPWithTimeByID(Int32.Parse(DisbursementLogic.GetCurrentCPIDByDep(DisbursementLogic.GetCurrentDep())));
             statusMessage.Text               = "The Collection Point has been updated to " + CurrentCollectionPointLbl.Text;
             statusMessage.Visible            = true;
             statusMessage.ForeColor          = Color.Green;
             ChangeCollectionPointBtn.Enabled = true;
         }
     }
     catch
     {
         statusMessage.Text      = "Please choose a collection point.";
         statusMessage.Visible   = true;
         statusMessage.ForeColor = Color.Red;
     }
 }
        private void BindLabels(int disbursementId)
        {
            DisbursementList dL = DisbursementLogic.GetDisbursementList(disbursementId);

            string status = dL.Status;

            LblDisbId.Text       = "DL" + disbursementId.ToString("0000");
            LblColDate.Text      = ((DateTime)dL.CollectionDate).ToString("d");
            LblCollectPoint.Text = DisbursementLogic.GetCurrentCPWithTimeByID(dL.CollectionPointID);
            LblDeptRep.Text      = dL.RepresentativeName;
            LblDeptName.Text     = DisbursementLogic.GetListofDepartments().Where(x => x.DeptID == dL.DepartmentID).Select(x => x.DepartmentName).FirstOrDefault();
            LblStatus.Text       = dL.Status;

            switch (status)
            {
            case ("Collected"):
            {
                BtnCancelDis.Visible   = false;
                LblCollectedBy.Visible = true;
                ImgSignature.ImageUrl  = "http://localhost/Team12_SSIS/Images/" + "DL" + dL.DisbursementID + ".jpg";
                ImgSignature.Visible   = true;
                break;
            }

            case ("Pending Collection"):
                BtnCancelDis.Visible = true;
                break;

            default:
                BtnCancelDis.Visible = false;
                break;
            }
        }
Ejemplo n.º 3
0
        public void TestGetCollectionPointNameAndId()
        {
            //This is english dept
            string currentDept = "ENGL";
            //This should show the current CP Id - currently is 6.
            string currentCPByDept = DisbursementLogic.GetCurrentCPIDByDep(currentDept);

            Console.WriteLine(currentCPByDept);
            //This should show University Hospital, 11A.M
            string currentCPNameById = DisbursementLogic.GetCurrentCPWithTimeByID(Int32.Parse(currentCPByDept));

            Console.WriteLine(currentCPNameById);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            statusMessage = Master.FindControl("Lblstatus") as Label;

            if (!IsPostBack)
            {
                statusMessage.Visible               = false;
                CollectionPointRbtnl.DataSource     = DisbursementLogic.ListCollectionPoints();
                CollectionPointRbtnl.DataTextField  = "CollectionPoint1";
                CollectionPointRbtnl.DataValueField = "CollectionPointID";
                CollectionPointRbtnl.DataBind();
                CurrentCollectionPointLbl.Text = DisbursementLogic.GetCurrentCPWithTimeByID(Int32.Parse(DisbursementLogic.GetCurrentCPIDByDep(DisbursementLogic.GetCurrentDep())));
            }
            //else
            //	ChangedLbl.Visible = true;
        }
        protected void GridViewDisbList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow && (DisbursementList)e.Row.DataItem != null)
            {
                DisbursementList dL       = (DisbursementList)e.Row.DataItem;
                string           dept     = DisbursementLogic.GetListofDepartments().Where(x => x.DeptID == dL.DepartmentID).Select(x => x.DepartmentName).FirstOrDefault();
                string           colPoint = DisbursementLogic.GetCurrentCPWithTimeByID(dL.CollectionPointID);

                Label lblDept = e.Row.FindControl("LblDept") as Label;
                if (lblDept != null)
                {
                    lblDept.Text = dept;
                }
                Label lblColPoint = e.Row.FindControl("LblColPoint") as Label;
                if (lblColPoint != null)
                {
                    lblColPoint.Text = colPoint;
                }
            }
        }