Пример #1
0
        public ActionResult Edit(ClsCustomer cust)
        {
            CustomerClient cusclt = new CustomerClient();

            cusclt.Edit(cust.customer);
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public void AddNew(ClsCustomer pObj_Customer)
 {
     this.mObj_Customer = pObj_Customer;
     this.mTmpKey       = 0;
     this.SetupPage();
     this.Update();
 }
Пример #3
0
        public void CustomerListOK()
        {
            //create an instance of the class we cant to create
            ClsCustomerCollection AllCustomers = new ClsCustomerCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a a list of objects
            List <ClsCustomer> TestList = new List <ClsCustomer>();
            //add an item to the list
            //create the item of test data
            ClsCustomer TestItem = new ClsCustomer();

            //set it's properties
            TestItem.Active   = true;
            TestItem.CustID   = 2;
            TestItem.Address1 = "70 Harrow Road";
            TestItem.Address2 = "Westcotes";
            TestItem.Address3 = "safdfsgfs";
            TestItem.City     = "Leicester";
            TestItem.Forename = "Vicki";
            TestItem.Surname  = "Bills";
            TestItem.Postcode = "LE3 2EU";
            TestItem.Tel      = "07910453483";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllCustomers.CustomerList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.CustomerList, TestList);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "notpass")
                {
                    Response.Write("<script>alert('لم يتم الحفظ');</script>");
                }

                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        InvCustomer customer = new ClsCustomer().get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtName.Text          = customer.Name;
                        txtmail.Text          = customer.Email;
                        txtPhone.Text         = customer.Phone;
                        txtRemarks.Text       = customer.Remarks;
                        txtAddress.Text       = customer.Address;
                        ddlType.SelectedValue = customer.Type.ToString();
                        btnEdit.Visible       = true;
                    }
                }
            }
        }
Пример #5
0
        public void AddressPropertyOk()
        {
            ClsCustomer customer = new ClsCustomer();
            string      test     = "test";

            Assert.AreEqual(customer.Adress, test);
        }
Пример #6
0
 public List <CustomerModel> GetCustomerDetail(UserModel objUserModel)
 {
     objClsCustomer = new ClsCustomer();
     try
     {
         return(objClsCustomer.GetCustomerDetail(objUserModel));
     }
     catch (Exception ex)
     {
         strGuid      = DateTime.Now.ToString("ddMMyyyyhhmmss");
         levelCounter = 0;
         ClsLogging.writefile("---------------------------------------------------------------------------------", ClsLogging.LogType.CL_Exception);
         ClsLogging.writefile("Exception Ouccred Section Start", ClsLogging.LogType.CL_Exception);
         ClsLogging.writefile("Unique ID " + strGuid, ClsLogging.LogType.CL_Exception);
         ClsLogging.writefile("Exception In GetCustomerDetail" + ex.Message, ClsLogging.LogType.CL_Exception);
         foreach (StackFrame stackFrame in new StackTrace(ex, true).GetFrames().Where(x => x.GetFileLineNumber() != 0 && x.GetFileName() != null))
         {
             ClsLogging.writefile("Level : " + Convert.ToString(++levelCounter), ClsLogging.LogType.CL_Exception);
             ClsLogging.writefile("File Name : " + stackFrame.GetFileName(), ClsLogging.LogType.CL_Exception);
             ClsLogging.writefile("Method Name : " + stackFrame.GetMethod().Name, ClsLogging.LogType.CL_Exception);
             ClsLogging.writefile("Line Number : " + stackFrame.GetFileLineNumber(), ClsLogging.LogType.CL_Exception);
             ClsLogging.writefile("Col Number : " + stackFrame.GetFileColumnNumber(), ClsLogging.LogType.CL_Exception);
         }
         ClsLogging.writefile("Exception Ouccred Section End", ClsLogging.LogType.CL_Exception);
         throw ex;
     }
 }
Пример #7
0
        public void PasswordPropertyOk()
        {
            ClsCustomer customer = new ClsCustomer();
            string      test     = "test";

            Assert.AreEqual(customer.Password, test);
        }
Пример #8
0
        public void UsernamePropertyOk()
        {
            ClsCustomer customer = new ClsCustomer();
            string      test     = "test";

            Assert.AreEqual(customer.Username, test);
        }
Пример #9
0
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();

            ClsCustomer TestItem = new ClsCustomer();
            Name        cName    = new Name("Dale", "Doback");

            Int32 PrimaryKey = 0;

            TestItem.CustomerID   = 1;
            TestItem.CustomerName = cName;
            TestItem.DateOfBirth  = DateTime.Now.Date;
            TestItem.Email        = "*****@*****.**";
            TestItem.PhoneNumber  = "00009278362";
            TestItem.Password     = "******";
            TestItem.CardNo       = "0202983729182916";
            TestItem.CardDate     = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;

            PrimaryKey = AllCustomers.Add();

            TestItem.CustomerID = PrimaryKey;

            AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Пример #10
0
        public void ListAndCountOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();


            List <ClsCustomer> TestList = new List <ClsCustomer>();

            ClsCustomer TestItem = new ClsCustomer();
            Name        cName    = new Name("Dale", "Doback");

            TestItem.CustomerID   = 5;
            TestItem.CustomerName = cName;
            TestItem.DateOfBirth  = DateTime.Now.Date;
            TestItem.Email        = "*****@*****.**";
            TestItem.PhoneNumber  = "00009278362";
            TestItem.Password     = "******";
            TestItem.CardNo       = "0202983729182916";
            TestItem.CardDate     = DateTime.Now.Date;

            TestList.Add(TestItem);

            AllCustomers.CustomerList = TestList;

            Assert.AreEqual(AllCustomers.Count, TestList.Count);
        }
Пример #11
0
        public ActionResult Edit(int Id)
        {
            CustomerClient cusclt = new CustomerClient();
            ClsCustomer    cus    = new ClsCustomer();

            cus.customer = cusclt.Find(Id);
            return(View("Edit", cus));
        }
Пример #12
0
        public void ActivePropertyOk()
        {
            ClsCustomer customer = new ClsCustomer();
            bool        test     = true;

            customer.Active = test;

            Assert.AreEqual(customer.Active, test);
        }
Пример #13
0
        public void DatePropertyOk()
        {
            ClsCustomer customer = new ClsCustomer();
            DateTime    test     = DateTime.Now.Date;

            customer.JoinDate = test;

            Assert.AreEqual(customer.JoinDate, test);
        }
Пример #14
0
        public void CustomerPropertyOk()
        {
            ClsCustomer customer = new ClsCustomer();
            int         test     = 1;

            customer.CustomerId = test;

            Assert.AreEqual(customer.CustomerId, test);
        }
Пример #15
0
        public void InstanceOK()
        {
            //create instance of the class we want to create
            ClsCustomer aCustomer = new ClsCustomer();

            //<<<<<<<<< Temporary merge branch 1
            //test to see that it now exist
            Assert.IsNotNull(aCustomer);
        }
Пример #16
0
        public void CustomerNameOk()
        {
            //Create an instance of name and Customer
            Name        n1 = new Name("Dale", "Doback");
            ClsCustomer s1 = new ClsCustomer();

            //Insert the test name
            s1.CustomerName = n1;
            //Compare if equal
            Assert.AreEqual(n1, s1.CustomerName);
        }
Пример #17
0
        public void ActivePasswordOk()
        {
            //create instance of the class we want to create
            ClsCustomer aCustomer = new ClsCustomer();
            //create some test data to assign to Customer
            String TestData = "Password123";

            //assign the data to the Customer
            aCustomer.Password = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(aCustomer.Password, TestData);
        }
Пример #18
0
        public void ActiveCardNumberOk()
        {
            //create instance of the class we want to create
            ClsCustomer aCustomer = new ClsCustomer();
            //create some test data to assign to Customer
            String TestData = "3554 3773 2281 1839";

            //assign the data to the Customer
            aCustomer.CardNo = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(aCustomer.CardNo, TestData);
        }
Пример #19
0
        public void ActivePhoneNumberOk()
        {
            //create instance of the class we want to create
            ClsCustomer aCustomer = new ClsCustomer();
            //create some test data to assign to Customer
            String TestData = "07784533627";

            //assign the data to the Customer
            aCustomer.PhoneNumber = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(aCustomer.PhoneNumber, TestData);
        }
Пример #20
0
        public void ActiveEmailAddressOk()
        {
            //create instance of the class we want to create
            ClsCustomer aCustomer = new ClsCustomer();
            //create some test data to assign to Customer
            String TestData = "*****@*****.**";

            //assign the data to the Customer
            aCustomer.Email = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(aCustomer.Email, TestData);
        }
Пример #21
0
        public void ActiveDateOfBirthOk()
        {
            //create instance of the class we want to create
            ClsCustomer aCustomer = new ClsCustomer();
            //create some test data to assign to Customer
            DateTime TestData = DateTime.Today;

            //assign the data to the Customer
            aCustomer.DateOfBirth = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(aCustomer.DateOfBirth, TestData);
        }
Пример #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.EOCb_Accept.Execute += new EO.Web.CallbackEventHandler(EOCb_Accept_Execute);
            this.EOCb_Cancel.Execute += new EO.Web.CallbackEventHandler(EOCb_Cancel_Execute);

            //[-]

            this.mObjID        = (string)this.ViewState[CnsObjID];
            this.mObj_Customer = (ClsCustomer)this.Session[this.mObjID + CnsObj_Customer];
            this.mObj_Address  = (ClsAddress)this.Session[this.mObjID + CnsObj_Address];
            this.mTmpKey       = (this.ViewState[CnsTmpKey] != null) ? (Int64)this.ViewState[CnsTmpKey] : 0;
        }
Пример #23
0
        public void ValidMethodOk()
        {
            //creates an instamce of customer
            ClsCustomer aCustomer = new ClsCustomer();
            //string variable to store any error message
            string Error = "";

            //invoke method

            Error = aCustomer.Valid(cFirstName, cLastName, cDateOfBirth, cEmail, cPhoneNumber, cPassword, cCardNo, cCardDate);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Пример #24
0
        public void FindMethodOk()
        {
            //create new instance of customer
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result of method
            Boolean Found = false;
            //create test data
            Int32 CustomerID = 2;

            //invoke method
            Found = aCustomer.Find(CustomerID);
            //test to see if result is correct
            Assert.IsTrue(Found);
        }
Пример #25
0
        public void CustomerPasswordMinPlusOne()
        {
            //new instance of customer
            ClsCustomer aCustomer = new ClsCustomer();
            //string variable to store any error message
            string Error = "";
            //creating test data to pass the method
            string cPassword = "******";

            //invoke method
            Error = aCustomer.Valid(cFirstName, cLastName, cDateOfBirth, cEmail, cPhoneNumber, cPassword, cCardNo, cCardDate);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Пример #26
0
        public void CustomerDateOfBirthMin()
        {
            //new instance of customer
            ClsCustomer aCustomer = new ClsCustomer();
            //string variable to store any error message
            string Error = "";
            //create test data to pass the method
            DateTime customerDOB;

            customerDOB = DateTime.Now.Date;

            string cDateOfBirth = customerDOB.ToString();

            //invoke method
            Error = aCustomer.Valid(cFirstName, cLastName, cDateOfBirth, cEmail, cPhoneNumber, cPassword, cCardNo, cCardDate);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Security
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            //else
            //{
            //    if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.AddBank, Request.Cookies["user"]["Permission"].ToString()))
            //        Response.Redirect("~/Finance_Module/UnAuthorized.aspx");
            //}

            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "notpass")
                {
                    Response.Write("<script>alert('لم يتم الحفظ');</script>");
                }

                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        InvCustomer customer = new ClsCustomer().get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtName.Text          = customer.Name;
                        txtmail.Text          = customer.Email;
                        txtPhone.Text         = customer.Phone;
                        txtRemarks.Text       = customer.Remarks;
                        txtAddress.Text       = customer.Address;
                        ddlType.SelectedValue = customer.Type.ToString();
                        btnSave.Visible       = false;
                        btnEdit.Visible       = true;
                    }
                    else
                    {
                        btnSave.Visible = true;
                        btnEdit.Visible = false;
                    }
                }
            }
        }
Пример #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Create a new customer

        ClsCustomer customer = new ClsCustomer();

        //get data from session object
        customer = (ClsCustomer)Session["customer"];

        Response.Write("<b> LOGIN SUCCESSFUL </b>");

        lblFirstName.Text   = customer.CustomerName.getFirstName();
        lblLastName.Text    = customer.CustomerName.getLastName();
        lblDateOfBirth.Text = customer.DateOfBirth.ToShortDateString();
        lblEmail.Text       = customer.Email;
        lblPhoneNumber.Text = customer.PhoneNumber;
        lblPassword.Text    = customer.Password;
        lblCardNo.Text      = customer.CardNo;
        lblCardDate.Text    = customer.CardDate.ToShortDateString();
    }
Пример #29
0
        public void ThisCustomerPropertyOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();

            ClsCustomer TestCustomer = new ClsCustomer();
            Name        cName        = new Name("Dale", "Doback");

            TestCustomer.CustomerID   = 5;
            TestCustomer.CustomerName = cName;
            TestCustomer.DateOfBirth  = DateTime.Now.Date;
            TestCustomer.Email        = "*****@*****.**";
            TestCustomer.PhoneNumber  = "00009278362";
            TestCustomer.Password     = "******";
            TestCustomer.CardNo       = "0202983729182916";
            TestCustomer.CardDate     = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestCustomer;

            Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer);
        }
Пример #30
0
        public void CustomerCardDateFound()
        {
            //create new customer
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result method
            Boolean Found = false;
            //boolean variable to record if data is OK (assumes that it is)
            Boolean Ok = true;
            //creates some test data to assign to use with the method
            Int32 cID = 2;

            //invoke the method
            Found = aCustomer.Find(cID);
            //check the customer name
            if (aCustomer.CardDate != Convert.ToDateTime("24/07/2023"))
            {
                Ok = false;
            }
            //test to check result is correct
            Assert.IsTrue(Ok);
        }