public void ValidMethodOK()
        {
            var AClaim = new clsClaim();
            var Error  = "";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreEqual(Error, "");
        }
        public void ClaimStatusNotBoolean()
        {
            var AClaim      = new clsClaim();
            var Error       = "";
            var ClaimStatus = "1";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreNotEqual(Error, "");
        }
        public void ClaimReasonMid()
        {
            var AClaim      = new clsClaim();
            var Error       = "";
            var ClaimReason = new string('f', 36552);

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreEqual(Error, "");
        }
        public void ClaimReasonMaxPlusOne()
        {
            var AClaim      = new clsClaim();
            var Error       = "";
            var ClaimReason = new string('Z', 65536);

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreNotEqual(Error, "");
        }
        public void ClaimReasonMinPlusOne()
        {
            var AClaim      = new clsClaim();
            var Error       = "";
            var ClaimReason = "aa";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreEqual(Error, "");
        }
        public void ClaimAmntMid()
        {
            var AClaim    = new clsClaim();
            var Error     = "";
            var ClaimAmnt = "74020.73";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreEqual(Error, "");
        }
        public void ClaimAmntMaxPlusOne()
        {
            var AClaim    = new clsClaim();
            var Error     = "";
            var ClaimAmnt = "1000000.00";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreNotEqual(Error, "");
        }
        public void CustomerIDNotNumber()
        {
            var AClaim     = new clsClaim();
            var Error      = "";
            var CustomerID = "a";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreNotEqual(Error, "");
        }
        public void CustomerIDMax()
        {
            var AClaim     = new clsClaim();
            var Error      = "";
            var CustomerID = "2147483647";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreEqual(Error, "");
        }
Exemple #10
0
        public void StaffIDMinLessOne()
        {
            var AClaim  = new clsClaim();
            var Error   = "";
            var StaffID = "0";

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreNotEqual(Error, "");
        }
Exemple #11
0
        public void ClaimDateMid()
        {
            var AClaim        = new clsClaim();
            var Error         = "";
            var ClaimDateTemp = DateTime.Now.Date.AddMonths(-1);
            var ClaimDate     = ClaimDateTemp.ToString();

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreEqual(Error, "");
        }
Exemple #12
0
        public void ClaimDateMaxPlusOne()
        {
            var AClaim        = new clsClaim();
            var Error         = "";
            var ClaimDateTemp = DateTime.Now.Date.AddSeconds(1);
            var ClaimDate     = ClaimDateTemp.ToString();

            Error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);
            Assert.AreNotEqual(Error, "");
        }
Exemple #13
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        var AClaim      = new clsClaim();
        var ClaimReason = txtClaimReason.Text;
        var ClaimDate   = txtClaimDate.Text;
        var ClaimAmnt   = txtClaimAmnt.Text;
        var CustomerID  = txtCustomerID.Text;
        var StaffID     = txtStaffID.Text;
        var ClaimStatus = txtClaimStatus.Text;
        var error       = "";

        error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus);

        if (error == "")
        {
            AClaim.ClaimID     = ClaimID;
            AClaim.ClaimReason = ClaimReason;
            AClaim.ClaimDate   = Convert.ToDateTime(ClaimDate);
            AClaim.CustomerID  = Convert.ToInt32(CustomerID);
            AClaim.ClaimAmnt   = Convert.ToDecimal(ClaimAmnt);
            AClaim.ClaimStatus = Convert.ToBoolean(ClaimStatus);
            AClaim.StaffID     = Convert.ToInt32(StaffID);

            var ClaimList = new clsClaimCollection();

            if (ClaimID == -1)
            {
                ClaimList.ThisClaim = AClaim;
                ClaimList.Add();
            }
            else
            {
                ClaimList.ThisClaim.Find(ClaimID);
                ClaimList.ThisClaim = AClaim;
                ClaimList.Update();
            }

            Response.Redirect("ClaimList.aspx");
        }
        else
        {
            lblError.Text = error;
        }
    }