/// <summary>
        /// Added By : Himanshu Pandya
        /// Date : 30-12-2012
        /// Desc : Fill Customer Details from Cearch Search Popup
        /// </summary>
        public void BindCustomerDetails()
        {
            try
            {
                if (!string.IsNullOrEmpty(hdnCustomerId.Value))
                {
                    objCustomer = new clsCustomer();
                    dtCustomer = new DataTable();
                    objCustomer.CustomerId = Convert.ToInt64(hdnCustomerId.Value);
                    dtCustomer = objCustomer.SearcheAllCustomerWSearchFilters();
                    if (dtCustomer.Rows.Count > 0)
                    {
                        //Fill Customer Details
                        txtFDCustomerNo.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                        ddlCustomerType.SelectedIndex = ddlCustomerType.Items.IndexOf(ddlCustomerType.Items.FindByText(dtCustomer.Rows[0]["CustomerTypeName"].ToString()));
                        ddlFDCustomernamePrefix.SelectedIndex = ddlFDCustomernamePrefix.Items.IndexOf(ddlFDCustomernamePrefix.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                        txtFDCusotmerFirstname.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                        txtFDCustomerMiddlename.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                        txtFDCustomerLastname.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;

                        BindFixDepositeTypes();
                    }
                }
            }
            catch
            { }
            finally
            {
                objCustomer = new clsCustomer();
                dtCustomer = new DataTable();
            }
        }
        public void ListAndCountOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            List <clsCustomer>    TestList     = new List <clsCustomer>();
            clsCustomer           TestCustomer = new clsCustomer();

            TestCustomer.Customer_id       = 1;
            TestCustomer.Name              = "Joe,Bloggs";
            TestCustomer.Address           = "2 Random Street,RandomTown,RandomCounty,RN27FT";
            TestCustomer.Email             = "*****@*****.**";
            TestCustomer.Password          = "******";
            TestCustomer.Marketing_emails  = false;
            TestCustomer.Registration_date = DateTime.Now.Date;

            TestList.Add(TestCustomer);
            AllCustomers.CustomerList = TestList;
            Assert.AreEqual(AllCustomers.Count, TestList.Count);
        }
Esempio n. 3
0
        public void DateOfBirthExtremeMin()
        {
            //create instance of class we want
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store error message
            String Error = "";
            //test data to pass
            DateTime TestDate;

            TestDate = DateTime.Now.Date.AddYears(-1000);//this should trigger an error
            string DateOfBirth = TestDate.ToString();

            //invoke method
            Error = ACustomer.Valid(CustomerName, CustomerEmail, DateAdded,
                                    DateOfBirth, Ballance);
            //see if result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 4
0
        public void CustomerListOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //Test data to assign to property
            List <clsCustomer> TestList = new List <clsCustomer>();
            clsCustomer        TestItem = new clsCustomer();

            TestItem.ID             = 1;
            TestItem.FullName       = "John Green";
            TestItem.Address        = "Test street";
            TestItem.EmailAddress   = "*****@*****.**";
            TestItem.DateRegistered = DateTime.Now.Date;
            TestItem.Above18        = true;
            TestList.Add(TestItem);
            AllCustomers.CustomerList = TestList;
            Assert.AreEqual(AllCustomers.CustomerList, TestList);
        }
Esempio n. 5
0
        public void CustomerDateOfBirthExtremeMin()
        {
            //create an instance of the class customer
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store error message
            string   Error = "";
            DateTime TestDate;

            //set to todays date
            TestDate = DateTime.Now.Date;
            //convert date to a string variable
            string CDOB = TestDate.ToString();

            //invoke the method
            Error = ACustomer.Valid(CName, CDOB, CEmail, CBillingAddress, CPass);
            //test to see if result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 6
0
        public void TestAnyCurrentOrdersFound()
        {
            clsCustomer AnCustomer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 2;

            Found = AnCustomer.Find(CustomerNo);

            if (AnCustomer.CurrentOrder != true)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Esempio n. 7
0
        public void TestCustomerShippingAddressFound()
        {
            clsCustomer AnCustomer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 2;

            Found = AnCustomer.Find(CustomerNo);

            if (AnCustomer.CustomerShippingAddress != "69 Zoo Doe")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Esempio n. 8
0
        public void TestCustomerEmailFound()
        {
            clsCustomer AnCustomer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 2;

            Found = AnCustomer.Find(CustomerNo);

            if (AnCustomer.CustomerEmail != "*****@*****.**")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Esempio n. 9
0
        public void TestCustomerNameFound()
        {
            clsCustomer AnCustomer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 2;

            Found = AnCustomer.Find(CustomerNo);

            if (AnCustomer.CustomerName != "Doe Cameron")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Esempio n. 10
0
        public void TestDateWhenJoinedFound()
        {
            clsCustomer AnCustomer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 2;

            Found = AnCustomer.Find(CustomerNo);

            if (AnCustomer.DateWhenJoined != Convert.ToDateTime("27/02/2020"))
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
        public void UpdateMethodOK()
        {
            //create an instance of the class we waqnt to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CustomerID        = 21;
            TestItem.CustomerFirstName = "Sophie";
            TestItem.CustomerLastName  = "Vergara";
            TestItem.Email             = "*****@*****.**";
            TestItem.TelephoneNo       = "07965847361";
            TestItem.Address1          = "123 ABC Lane";
            TestItem.Address2          = "San Jose";
            TestItem.PostCode          = "SJ1 98KL";
            TestItem.CustomerPassword  = "******";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //modify the test data
            TestItem.CustomerID        = 21;
            TestItem.CustomerFirstName = "Sophie";
            TestItem.CustomerLastName  = "Vergara";
            TestItem.Email             = "*****@*****.**";
            TestItem.TelephoneNo       = "07965847361";
            TestItem.Address1          = "1 Apple Street";
            TestItem.Address2          = "San Jose";
            TestItem.PostCode          = "SJ1 9OP";
            TestItem.CustomerPassword  = "******";
            //set the record based on the new test data
            AllCustomers.ThisCustomer = TestItem;
            //update the record
            AllCustomers.Update();
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see ThisCustomer matches the test data
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active       = true;
            TestItem.CustomerID   = 21;
            TestItem.FirstName    = "Ryan";
            TestItem.LastName     = "Fretwell";
            TestItem.Address      = "Somewhere";
            TestItem.PostCode     = "LE30EB";
            TestItem.PhoneNumber  = "07775734887";
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.DateAdded    = DateTime.Now.Date;
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //modify the test data
            TestItem.Active       = false;
            TestItem.CustomerID   = 11;
            TestItem.FirstName    = "Ryann";
            TestItem.LastName     = "Fretwelll";
            TestItem.Address      = "Somewheree";
            TestItem.PostCode     = "LE20EB";
            TestItem.PhoneNumber  = "07775734888";
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.DateAdded    = DateTime.Now.Date;
            //set the record based on the new test data
            AllCustomers.ThisCustomer = TestItem;
            //update the record
            AllCustomers.Update();
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see ThisCustomer matches the test data
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Esempio n. 13
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection("Fbloggs");
            //create an instance of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            TestItem.FirstName     = "fred";
            TestItem.Surname       = "bloggs";
            TestItem.dateOfBirth   = DateTime.Now.Date.AddYears(-19);
            TestItem.Gender        = "male";
            TestItem.ContactNumber = "01167";
            TestItem.EMail         = "*****@*****.**";
            TestItem.HouseNo       = "2";
            TestItem.PostCode      = "LE5 6HP";
            TestItem.Title         = "Mr";
            //set ThisCustomer to validate test data
            AllCustomer.ThisCustomer = TestItem;
            //add the record
            PK = AllCustomer.Add();
            //set primary key of test data
            TestItem.Id = PK;
            //modify the record
            TestItem.FirstName     = "fred";
            TestItem.Surname       = "bloggs";
            TestItem.dateOfBirth   = DateTime.Now.Date.AddYears(-19);
            TestItem.Gender        = "male";
            TestItem.ContactNumber = "01167";
            TestItem.EMail         = "*****@*****.**";
            TestItem.HouseNo       = "2";
            TestItem.PostCode      = "LE5 6HP";
            TestItem.Title         = "Mr";
            //set the record based on the new record
            AllCustomer.ThisCustomer = TestItem;
            //update the record
            AllCustomer.Update();
            //find the record
            AllCustomer.ThisCustomer.Find(PK);
            //test to see that it exists
            Assert.AreEqual(AllCustomer.ThisCustomer, TestItem);
        }
Esempio n. 14
0
        public void DateaddedMin()
        {
            //create an instance of the class we want
            clsCustomer AnCustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test data
            DateTime TestDate;

            //set the data to todays date
            TestDate = DateTime.Now.Date;
            //convert the data variable to a string variable
            string Dateadded = TestDate.ToString();

            //invoke the method
            Error = AnCustomer.Valid(CustomerFirstName, CustomerLastName, CustomerUserName, Dateadded);
            //test to see that the results is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 15
0
        public void ListAndCountOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            List <clsCustomer>    TestList     = new List <clsCustomer>();
            clsCustomer           TestItem     = new clsCustomer();

            //TestItem.Active = true;
            TestItem.ProductNo   = 1;
            TestItem.PhoneNumber = "0777777777777";
            TestItem.FullName    = "Bob Smith";
            TestItem.Email       = "*****@*****.**";
            TestItem.CustomerID  = 1;
            TestItem.Date        = DateTime.Now.Date;
            TestItem.Address     = "9 Hamilton Road LE5 J3D";
            TestItem.OrderNo     = 1;
            TestList.Add(TestItem);
            AllCustomers.CustomerList = TestList;
            Assert.AreEqual(AllCustomers.Count, TestList.Count);
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        clsCustomer obj = new clsCustomer();

        obj.Name    = txtName.Text;
        obj.Address = txtAddress.Text;
        obj.Phone   = txtPhone.Text;
        obj.Email   = txtEmail.Text;
        obj.Logo    = UploadImage();
        obj.Op      = 1;
        obj.CustomerMaster(obj);
        msg.Text = "<script type='text/javascript'>alert('Saved');</script>";
        LoadCustomer();
        txtName.Text        = "";
        txtAddress.Text     = "";
        txtEmail.Text       = "";
        txtPhone.Text       = "";
        pnlExisting.Visible = true;
    }
Esempio n. 17
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //create a new instance of clsCustomer
        clsCustomer ACustomer = new clsCustomer();
        //capture the data
        string Username    = txtUsername.Text;
        string Password    = txtPassword.Text;
        string Email       = txtEmail.Text;
        string DateCreated = txtDateCreated.Text;
        string Error       = "";

        // validate the data
        Error = ACustomer.Valid(Username, Password, Email, DateCreated);
        if (Error == "")
        {
            //capture the data
            ACustomer.CustomerId  = CustomerId;
            ACustomer.Username    = Username;
            ACustomer.Password    = Password;
            ACustomer.Email       = Email;
            ACustomer.DateCreated = Convert.ToDateTime(DateCreated);
            ACustomer.Active      = chkActiveAccount.Checked;

            clsCustomerCollection Customers = new clsCustomerCollection();

            if (CustomerId == -1)
            {
                Customers.ThisCustomer = ACustomer;
                Customers.Add();
            }
            else
            {
                Customers.ThisCustomer.Find(CustomerId);
                Customers.ThisCustomer = ACustomer;
                Customers.Update();
            }
            Response.Redirect("CustomerList.aspx");
        }
        else
        {
            lblError.Text = Error;
        }
    }
Esempio n. 18
0
        public void EmailValidTests()
        {
            //examples of valid emails
            clsCustomer newCustomer = new clsCustomer();

            String[] validEmails = new string[3]
            {
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**"
            };
            bool outcome = false;

            foreach (String email in validEmails)
            {
                outcome |= !(newCustomer.ValidateEmail(email) == "");
            }
            Assert.AreEqual(outcome, false);
        }
Esempio n. 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsCustomer newCustomer = new clsCustomer();

        newCustomer = (clsCustomer)Session["newCustomer"];
        //Response.Write(newCustomer.name);
        if (newCustomer != null)
        {
            IDAppearBox.Text         = Convert.ToString(newCustomer.CustomerID);
            NameAppearBox.Text       = newCustomer.name;
            SurnameAppearBox.Text    = newCustomer.surname;
            MobileAppearBox.Text     = Convert.ToString(newCustomer.PhoneNumber);
            EmailAppearBox.Text      = newCustomer.email;
            AddressAppearBox.Text    = newCustomer.Address;
            DateAppearBox.Text       = Convert.ToString(newCustomer.DOB);
            toDeleteCheckBox.Checked = newCustomer.toDelete;
            globalCustomer           = newCustomer;
        }
    }
Esempio n. 20
0
        public void TestHouseNoFound()
        {
            clsCustomer Customer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 48;

            Found = Customer.Find(CustomerNo);

            if (Customer.HouseNo != 999)
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
Esempio n. 21
0
        public void TestEMailFound()
        {
            clsCustomer Customer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 48;

            Found = Customer.Find(CustomerNo);

            if (Customer.EMail != "*****@*****.**")
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
    protected void grdCustomer_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        HiddenField hdID       = (HiddenField)grdCustomer.Rows[e.RowIndex].FindControl("hdID");
        Label       lblName    = (Label)grdCustomer.Rows[e.RowIndex].FindControl("lblName");
        Label       lblAddress = (Label)grdCustomer.Rows[e.RowIndex].FindControl("lblAddress");
        Label       lblPhone   = (Label)grdCustomer.Rows[e.RowIndex].FindControl("lblPhone");
        Label       lblEmail   = (Label)grdCustomer.Rows[e.RowIndex].FindControl("lblEmail");
        HiddenField hdLogo     = (HiddenField)grdCustomer.Rows[e.RowIndex].FindControl("hdLogo");
        clsCustomer obj        = new clsCustomer();

        txtEName.Text       = lblName.Text;
        txtEAddress.Text    = lblAddress.Text;
        txtEPhone.Text      = lblPhone.Text;
        txtEEmail.Text      = lblEmail.Text;
        EImg.ImageUrl       = hdLogo.Value;
        hdEID.Value         = hdID.Value;
        pnlUpdate.Visible   = true;
        pnlExisting.Visible = false;
    }
Esempio n. 23
0
        public void TestHouseStreetFound()
        {
            clsCustomer Customer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 48;

            Found = Customer.Find(CustomerNo);

            if (Customer.HouseStreet != "TESTDATA")
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
Esempio n. 24
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        clsCustomer ACustomer = new clsCustomer();
        Int32       CustomerID;
        Boolean     Found = false;

        CustomerID = Convert.ToInt32(txtCustomerID.text);
        Found      = ACustomer.Find(Customer);

        if (Found == true)
        {
            txtCustomerID.text = ACustomer.CustomerID;
            txtName.text       = ACustomer.Name;
            txtAddress         = ACustomer.Address;
            txtDatecreated     = ACustomer.DateCreated;
            txtRegistered      = ACustomer.Registered;
            txtBalance         = ACustomer.Balance;
        }
    }
Esempio n. 25
0
        public void DateOfBirthMin()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date to todays date
            TestDate = DateTime.Now.Date;
            //convert the date variable to a string variable
            string DateOfBirth = TestDate.ToString();

            //invoke the method
            Error = AnCustomer.Valid(Username, Password, Address, DateOfBirth);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.AccountVerified = true;
            TestItem.AccountNo       = 1;
            TestItem.Ballance        = 1;
            TestItem.CustomerName    = "Gary";
            TestItem.CustomerEmail   = "*****@*****.**";
            TestItem.DateAdded       = DateTime.Now.Date;
            TestItem.DateOfBirth     = Convert.ToDateTime("01/01/2000");

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey         = AllCustomers.Add();
            TestItem.AccountNo = PrimaryKey;
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Esempio n. 27
0
        public void ThisCustomerPropertyOK()
        {
            //create list and check if you can access
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create test item
            clsCustomer TestItem = new clsCustomer();

            //create test properties
            TestItem.cusId            = 1000;
            TestItem.cusName          = "Rodney Dangerfield";
            TestItem.cusEmail         = "*****@*****.**";
            TestItem.cusPassword      = "******";
            TestItem.cusAccountStatus = true;
            TestItem.cusDateRegister  = DateTime.Now.Date;
            //set allCustomers.thisCustomer as the customer I just created
            AllCustomers.ThisCustomer = TestItem;
            //compare
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Esempio n. 28
0
        public void DateOfBirthMin()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date to today's date
            TestDate = DateTime.Now.Date.AddYears(-13);
            //convert the date variable to a string variable
            string DateOfBirth = TestDate.ToString();

            //invoke the method
            Error = ACustomer.Valid(Email, Password, FirstName, SurName, DateOfBirth, PhoneNumber, Address, Gender);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
        public void ThisCustomerPropertyOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create some test data to assign to the property
            clsCustomer TestCustomer = new clsCustomer();

            //set the properties of the test object
            TestCustomer.CustomerFirstName = "some first name";
            TestCustomer.CustomerLastName  = "some last name";
            TestCustomer.Email             = "*****@*****.**";
            TestCustomer.Address1          = "some address1";
            TestCustomer.Address2          = "some address2";
            TestCustomer.PostCode          = "LE1 1WE";
            //assign the data to the property
            AllCustomers.ThisCustomer = TestCustomer;
            //test to seee that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer);
        }
Esempio n. 30
0
        public void ThisCustomerPropertyOK()
        {
            //create an instanceof the clas we watn to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create some test data to asign ot the property
            clsCustomer TestCustomer = new clsCustomer();

            //set its properties
            TestCustomer.Active            = true;
            TestCustomer.CustomerID        = 1;
            TestCustomer.CustomerFirstName = "First";
            TestCustomer.CustomerLastName  = "Last";
            TestCustomer.CustomerEmail     = "*****@*****.**";
            TestCustomer.CustomerTeleNo    = "XXXXXXXXXX";
            //asign the data to the property
            AllCustomers.ThisCustomer = TestCustomer;
            //test to see that the teo valies are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer);
        }
Esempio n. 31
0
        public void TestPostCodeFound()
        {
            clsCustomer Customer = new clsCustomer();

            Boolean Found = false;

            Boolean OK = true;

            Int32 CustomerNo = 48;

            Found = Customer.Find(CustomerNo);

            if (Customer.PostCode != "TEST1")
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (security.LoginChecker() == true)
     {
         clsCustomer customer = new clsCustomer();
         DataTable dt = new DataTable();
         dt = customer.SearchCustomerByUsername(security.LoginUsername);
         if (dt.Rows.Count > 0 && dt != null)
         {
             txtName.Text = dt.Rows[0]["Forename"].ToString();
             txtSurname.Text = dt.Rows[0]["Surname"].ToString();
             if (dt.Rows[0]["SEX"].ToString() == "M")
             {
                 rdbMale.Checked = true;
             }
             else
             {
                 rdbFemale.Checked = true;
             }
             if (!string.IsNullOrEmpty(dt.Rows[0]["IDCard"].ToString()))
             {
                 txtIDCardNo.Text = dt.Rows[0]["IDCard"].ToString();
             }
             txtAddress.Text = dt.Rows[0]["Address"].ToString();
             txtDistrict.Text = dt.Rows[0]["District"].ToString();
             txtPrefecture.Text = dt.Rows[0]["Prefecture"].ToString();
             txtProvince.Text = dt.Rows[0]["Province"].ToString();
             txtZipcode.Text = dt.Rows[0]["Zipcode"].ToString();
             txtEmail.Text = dt.Rows[0]["Email"].ToString();
             txtTel.Text = dt.Rows[0]["Tel"].ToString();
             txtDetail.Text = dt.Rows[0]["Detail"].ToString();
         }
     }
     BindSelectedPackage();
     BindContent();
 }
Esempio n. 33
0
        /// <summary>
        /// Added By : Himanshu Pandya
        /// Date : 30-12-2012
        /// Desc : Fill Customer Details from Cearch Search Popup
        /// </summary>
        public void BindCustomerDetails(Int64 CustomerId)
        {
            DataTable dtCustomer;
            try
            {
                if (CustomerId > 0)
                {
                    ObjCust = new clsCustomer();
                    dtCustomer = new DataTable();
                    ObjCust.CustomerId = CustomerId;
                    dtCustomer = ObjCust.General_SearcheAllCustomerWSearchFilters();
                    if (dtCustomer.Rows.Count > 0)
                    {
                        //Fill Customer Details
                        hdnCustomerId.Value = Convert.ToString(CustomerId);
                        txtCustomerNo.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                        ddlCustomerPrefix.SelectedIndex = ddlCustomerPrefix.Items.IndexOf(ddlCustomerPrefix.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                        txtFirstName.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                        txtMiddleName.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                        txtLastName.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                        txtCustomerServiceYear.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["EmploymentYear"].ToString()) ? dtCustomer.Rows[0]["EmploymentYear"].ToString() : string.Empty;
                        txtCusotmerRetirementDate.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["RetirementYear"].ToString()) ? dtCustomer.Rows[0]["RetirementYear"].ToString() : string.Empty;
                        txtCustomerSalary.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["Salary"].ToString()) ? CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["Salary"])) : string.Empty;

                        hdnBindLoanData.Value = string.Empty;
                    }
                }
            }
            catch
            { }
            finally
            {
                ObjCust = new clsCustomer();
                dtCustomer = new DataTable();
            }
        }
        /// <summary>
        /// Added By : Himanshu Pandya  
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvCustomer_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ObjCustomer = new clsCustomer();
            dtCustomer = new DataTable();
            int iCustomerId;
            try
            {
                iCustomerId = Convert.ToInt32(((Label)gvCustomer.Rows[e.NewEditIndex].FindControl("lblCustomerId")).Text);
                if (iCustomerId > 0)
                {
                    ObjCustomer.CustomerCode = string.Empty;
                    ObjCustomer.FirstName = string.Empty;
                    ObjCustomer.DistrictName = string.Empty;
                    ObjCustomer.CustomerId = iCustomerId;
                    dtCustomer = ObjCustomer.SearcheAllCustomerWSearchFilters();
                    if (dtCustomer.Rows.Count > 0)
                    {
                        //Fill Cusotmer Details
                        hdnCusotmerId.Value = dtCustomer.Rows[0]["CustomerId"].ToString();
                        //ddlCustomerCodePrefix.SelectedIndex = ddlCustomerCodePrefix.Items.IndexOf(ddlCustomerCodePrefix.Items.FindByValue(dtCustomer.Rows[0]["CustomerCode"].ToString().Substring(0, 3)));
                        //txtCustomerNo.Text = dtCustomer.Rows[0]["CustomerCode"].ToString().Substring(4, (Convert.ToInt32(dtCustomer.Rows[0]["CustomerCode"].ToString().Length) - 4));
                        txtCustomerNo.Text = dtCustomer.Rows[0]["CustomerCode"].ToString();
                        ddlCustomerType.SelectedIndex = ddlCustomerType.Items.IndexOf(ddlCustomerType.Items.FindByValue(dtCustomer.Rows[0]["CustomerTypeId"].ToString().Trim()));

                        if (ddlCustomerType.SelectedValue.ToString().Equals(clsEnum.CustomerType.Sadharan.GetHashCode().ToString()))
                        {
                            ShowHideCustomerTypeFields(true);
                        }
                        else if (ddlCustomerType.SelectedValue.ToString().Equals(clsEnum.CustomerType.NaamMatra.GetHashCode().ToString()))
                        {
                            ShowHideCustomerTypeFields(false);
                        }
                        else
                        {
                            ShowHideCustomerTypeFields(true);
                        }

                        ddlCustomernamePrefix.SelectedIndex = ddlCustomernamePrefix.Items.IndexOf(ddlCustomernamePrefix.Items.FindByValue(dtCustomer.Rows[0]["NamePrifix"].ToString().Trim()));
                        ddlBankBranches.SelectedIndex = ddlBankBranches.Items.IndexOf(ddlBankBranches.Items.FindByValue(dtCustomer.Rows[0]["BankBranchId"].ToString().Trim()));
                        txtCusotmerFirstname.Text = dtCustomer.Rows[0]["FirstName"].ToString().Trim();
                        txtCustomerMiddlename.Text = dtCustomer.Rows[0]["MiddleName"].ToString().Trim();
                        txtCustomerLastname.Text = dtCustomer.Rows[0]["LastName"].ToString().Trim();
                        txtCusotomerAddress.Text = dtCustomer.Rows[0]["Address1"].ToString().Trim();
                        ddlCustomerVillage.Text = dtCustomer.Rows[0]["VillageId"].ToString().Trim();

                        //ddlCustomerVillage.SelectedIndex = ddlCustomerVillage.Items.IndexOf(ddlCustomerVillage.Items.FindByValue(dtCustomer.Rows[0]["VillageId"].ToString().Trim()));
                        ddlCustomerTaluka.SelectedIndex = ddlCustomerTaluka.Items.IndexOf(ddlCustomerTaluka.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString().Trim()));
                        ddlCustomerDistrict.SelectedIndex = ddlCustomerDistrict.Items.IndexOf(ddlCustomerDistrict.Items.FindByValue(dtCustomer.Rows[0]["DistrictId"].ToString().Trim()));
                        txtCustomerPinCode.Text = dtCustomer.Rows[0]["Pincode"].ToString().Trim();
                        txtCustomerPhoneNumber.Text = dtCustomer.Rows[0]["PhoneNumber"].ToString().Trim();
                        txtCustomerDOB.Text = dtCustomer.Rows[0]["DateOfBirth"].ToString();
                        txtCustomerEmail.Text = dtCustomer.Rows[0]["Email"].ToString();
                        txtCustomerSchoolname.Text = dtCustomer.Rows[0]["SchoolName"].ToString();
                        ddlCustomerSchoolTaluka.SelectedIndex = ddlCustomerSchoolTaluka.Items.IndexOf(ddlCustomerSchoolTaluka.Items.FindByValue(dtCustomer.Rows[0]["SchoolTahsilId"].ToString()));
                        ddlCusotmerSchoolDistrict.SelectedIndex = ddlCusotmerSchoolDistrict.Items.IndexOf(ddlCusotmerSchoolDistrict.Items.FindByValue(dtCustomer.Rows[0]["SchoolDistrictId"].ToString()));
                        txtCustomerSchoolPinCode.Text = dtCustomer.Rows[0]["SchoolPinCode"].ToString().Trim();
                        txtCustomerPanCard.Text = dtCustomer.Rows[0]["CustomerPanCard"].ToString().Trim();
                        //txtCustTotalYearOfService.Text = dtCustomer.Rows[0]["TotalYearOfService"].ToString().Trim();
                        txtCustEmploymentYear.Text = dtCustomer.Rows[0]["EmploymentYear"].ToString().Trim();
                        //txtCustomerYear.Text = dtCustomer.Rows[0]["CustomerYear"].ToString().Trim();
                        if (!string.IsNullOrEmpty(dtCustomer.Rows[0]["Salary"].ToString()))
                        {
                            txtCustomerSalary.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["Salary"]));
                        }
                        txtCustRetirementDate.Text = dtCustomer.Rows[0]["RetirementYear"].ToString().Trim();

                        //Fill Nominee Details
                        hdnNomineeId.Value = dtCustomer.Rows[0]["NomineeId"].ToString().Trim();
                        ddlCustNomineePrefix.SelectedIndex = ddlCustNomineePrefix.Items.IndexOf(ddlCustNomineePrefix.Items.FindByValue(dtCustomer.Rows[0]["NomineeNamePrefix"].ToString().Trim()));
                        txtCustnomineeFirstname.Text = dtCustomer.Rows[0]["NomineeFirstName"].ToString().Trim();
                        txtCustnomineeMiddlename.Text = dtCustomer.Rows[0]["NomineeMiddleName"].ToString().Trim();
                        txtCustnomineeLastname.Text = dtCustomer.Rows[0]["NomineeLastName"].ToString().Trim();
                        txtCustNomineeAddress.Text = dtCustomer.Rows[0]["NomineeAddress"].ToString().Trim();
                        ddlCustNomineeVillage.Text =dtCustomer.Rows[0]["NomineeVillageId"].ToString().Trim();
                        ddlCustNomineeTaluka.SelectedIndex = ddlCustNomineeTaluka.Items.IndexOf(ddlCustNomineeTaluka.Items.FindByValue(dtCustomer.Rows[0]["NomineeTahsilId"].ToString().Trim()));
                        ddlCustNomineeDistrict.SelectedIndex = ddlCustNomineeDistrict.Items.IndexOf(ddlCustNomineeDistrict.Items.FindByValue(dtCustomer.Rows[0]["NomineeDistrictId"].ToString().Trim()));
                        txtCustNomineePinCode.Text = dtCustomer.Rows[0]["NomineePinCode"].ToString().Trim();
                        txtCustNomineePhonenumber.Text = dtCustomer.Rows[0]["NomineePhoneNumber"].ToString().Trim();
                        txtCustNomineeOccupation.Text = dtCustomer.Rows[0]["NomineeOccupation"].ToString().Trim();
                        txtCustRelationWithNominee.Text = dtCustomer.Rows[0]["NomineeRelationWith"].ToString().Trim();

                        hdnAccountId.Value = dtCustomer.Rows[0]["AccountId"].ToString().Trim();
                        txtCustomerAccNumber.Text = dtCustomer.Rows[0]["AccountNumber"].ToString().Trim();
                        txtCustomerAccOpenDate.Text = dtCustomer.Rows[0]["OpeningDate"].ToString().Trim();
                        txtCustomerOpeningBalance.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["OpeningBalance"]));
                        txtCustomerShareAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["ShareBalance"]));
                        //ddlCustomerAccType.SelectedIndex = ddlCustomerAccType.Items.IndexOf(ddlCustomerAccType.Items.FindByValue(dtCustomer.Rows[0]["AccountTypeId"].ToString().Trim()));
                        //txtCustomerKayamnidhiBal.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["KayamNidhiBalance"]));
                        //txtCustomerAccountBal.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["AccountBalance"]));

                        /*teprary validation false
                         *
                         * txtCustomerAccNumber.Enabled = false;
                        txtCustomerAccOpenDate.Enabled = false;
                        txtCustomerOpeningBalance.Enabled = false;
                        txtCustomerShareAmt.Enabled = false;
                        ddlCustomerType.Enabled = false;
                        */
                        ShowHideCusotmerGrid(false);
                    }
                }
            }
            catch (Exception) { }
            finally { ObjCustomer = null; dtCustomer = null; }

            ShowHideCusotmerGrid(false);
        }
Esempio n. 35
0
 /// <summary>
 /// Added By : Himanshu Pandya
 /// Date : 30-12-2012
 /// Desc : Fill Customer Details from Cearch Search Popup
 /// </summary>
 public void BindWitnessDetails(Int64 CustomerId, string WitnessId)
 {
     DataTable dtCustomer;
     try
     {
         if ((CustomerId > 1) && (!string.IsNullOrEmpty(WitnessId)))
         {
             ObjCust = new clsCustomer();
             dtCustomer = new DataTable();
             ObjCust.CustomerId = CustomerId;
             dtCustomer = ObjCust.SearcheAllCustomerWSearchFilters();
             if (dtCustomer.Rows.Count > 0)
             {
                 //Fill Customer Details
                 switch (WitnessId)
                 {
                     case "1":
                         hdnWitnessID1.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix1.SelectedIndex = ddlCustWitnessPrefix1.Items.IndexOf(ddlCustWitnessPrefix1.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka1.SelectedIndex = ddlCustWitnessTaluka1.Items.IndexOf(ddlCustWitnessTaluka1.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                     case "2":
                         hdnWitnessID2.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix2.SelectedIndex = ddlCustWitnessPrefix2.Items.IndexOf(ddlCustWitnessPrefix2.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka2.SelectedIndex = ddlCustWitnessTaluka2.Items.IndexOf(ddlCustWitnessTaluka2.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                     case "3":
                         hdnWitnessID3.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix3.SelectedIndex = ddlCustWitnessPrefix3.Items.IndexOf(ddlCustWitnessPrefix3.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka3.SelectedIndex = ddlCustWitnessTaluka3.Items.IndexOf(ddlCustWitnessTaluka3.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                     case "4":
                         hdnWitnessID4.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix4.SelectedIndex = ddlCustWitnessPrefix4.Items.IndexOf(ddlCustWitnessPrefix4.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka4.SelectedIndex = ddlCustWitnessTaluka4.Items.IndexOf(ddlCustWitnessTaluka4.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                 }
                 hdnBindLoanData.Value = string.Empty;
             }
         }
     }
     catch { }
     finally
     {
         ObjCust = new clsCustomer();
         dtCustomer = new DataTable();
     }
 }
        /// <summary>
        /// Added By : pradip pawar
        /// Date : 25-03-2013
        /// Desc : Fill Customer Details from Search Popup
        /// </summary>
        private void BindCustomerDetails()
        {
            objCustomer = new clsCustomer();
            dtCustomer = new DataTable();
            try
            {
                if (!string.IsNullOrEmpty(hdnCustomerId.Value))
                {
                    objCustomer.CustomerId = Convert.ToInt64(hdnCustomerId.Value);
                    dtCustomer = objCustomer.GetCustomerDetailsByCustomerID();
                    if (dtCustomer.Rows.Count > 0)
                    {
                        //Fill Customer Details
                        ClearControl();
                        txtCustomerNo.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                        lblCustomerName.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FULLNAME"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                        lblCustomerType.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerTypeName"].ToString()) ? dtCustomer.Rows[0]["CustomerTypeName"].ToString() : string.Empty;
                        lblbShareBalance.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["ShareBalance"].ToString()) ? Convert.ToDouble(dtCustomer.Rows[0]["ShareBalance"]).ToString("N2") : string.Empty;
                        lblKayamNidhiBalance.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["KayamNidhiBalance"].ToString()) ?Convert.ToDouble( dtCustomer.Rows[0]["KayamNidhiBalance"]).ToString("N2") : string.Empty;
                        lblAccountBalance.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["AccountBalance"].ToString()) ?Convert.ToDouble(dtCustomer.Rows[0]["AccountBalance"]).ToString("N2") : string.Empty;

                    }
                }
            }
            catch (Exception ex)
            { }
            finally
            {
                objCustomer = new clsCustomer();
                dtCustomer = new DataTable();
            }
        }
Esempio n. 37
0
        /// <summary>
        ///  //Added By : Pradip pawar
        ///  Date:30-3-13
        ///  Description: Bind  Loan Type On Condition created date of customer
        ///  
        ///  Sadhe Karj:From 6 month 
        ///  prasangik:2 months
        ///  vishesh:4 months
        ///  aakasmik:1 month
        ///  
        /// </summary>
        public void BindLoanType(Int64 CustomerId)
        {
            DataTable dtLoanType;
            try
            {
                if (CustomerId > 0)
                {
                    ObjCust = new clsCustomer();
                    dtLoanType = new DataTable();
                    ObjCust.CustomerId = CustomerId;
                    dtLoanType = ObjCust.General_BindLoanTypeByCustomerId();

                    ddlLoanType.Items.Clear();
                    if (dtLoanType.Rows.Count > 0)
                    {
                        ddlLoanType.Items.Clear();
                        ddlLoanType.DataSource = null;
                        ddlLoanType.DataSource = dtLoanType;
                        ddlLoanType.DataTextField = "LoanTypeName";
                        ddlLoanType.DataValueField = "LoanTypeID";
                        ddlLoanType.DataBind();
                        ddlLoanType.Items.Insert(0, new ListItem("fuoMk", string.Empty));
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('"+(String)GetGlobalResourceObject("SharedResource", "NewCustomerLoanNotAllowed")+"')", true);
                        lblMessage.CssClass = "FailureMessage";
                        lblMessage.Text = (String)GetGlobalResourceObject("SharedResource", "NewCustomerLoanNotAllowed");

                    }

                }
            }
            catch
            { }
            finally
            {
                ObjCust = new clsCustomer();
                dtLoanType = new DataTable();
            }
        }
        /// <summary>
        /// Added By : Himanshu Pandya 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveCustomer_Click(object sender, EventArgs e)
        {
            ObjCustomer = new clsCustomer();
            ObjNominee = new clsNominees();
            ObjAccounts = new clsAccounts();
            try
            {
                if (!string.IsNullOrEmpty(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString())))
                {
                    //Customer Detials
                    ObjCustomer.CustomerId = !string.IsNullOrEmpty(hdnCusotmerId.Value) ? Convert.ToInt32(hdnCusotmerId.Value.ToString()) : 0;
                    //ObjCustomer.CustomerCode = (!string.IsNullOrEmpty(ddlCustomerCodePrefix.SelectedValue) ? ddlCustomerCodePrefix.SelectedValue.ToString() : string.Empty) + "-" + (!string.IsNullOrEmpty(txtCustomerNo.Text) ? txtCustomerNo.Text : string.Empty);
                    ObjCustomer.CustomerCode = !string.IsNullOrEmpty(txtCustomerNo.Text) ? txtCustomerNo.Text : string.Empty;
                    ObjCustomer.CustomerTypeId = !string.IsNullOrEmpty(ddlCustomerType.SelectedValue) ? Convert.ToInt32(ddlCustomerType.SelectedValue.ToString()) : 0;
                    ObjCustomer.BankBranchId = !string.IsNullOrEmpty(ddlBankBranches.SelectedValue) ? Convert.ToInt32(ddlBankBranches.SelectedValue.ToString()) : 0;
                    ObjCustomer.NamePrifix = !string.IsNullOrEmpty(ddlCustomernamePrefix.SelectedValue) ? ddlCustomernamePrefix.SelectedValue.ToString() : string.Empty;
                    ObjCustomer.FirstName = !string.IsNullOrEmpty(txtCusotmerFirstname.Text) ? txtCusotmerFirstname.Text : string.Empty;
                    ObjCustomer.MiddleName = !string.IsNullOrEmpty(txtCustomerMiddlename.Text) ? txtCustomerMiddlename.Text : string.Empty;
                    ObjCustomer.LastName = !string.IsNullOrEmpty(txtCustomerLastname.Text) ? txtCustomerLastname.Text : string.Empty;
                    ObjCustomer.Address1 = !string.IsNullOrEmpty(txtCusotomerAddress.Text) ? txtCusotomerAddress.Text : string.Empty;
                    ObjCustomer.VillageId = !string.IsNullOrEmpty(ddlCustomerVillage.Text) ? ddlCustomerVillage.Text : string.Empty;

                    //ObjCustomer.VillageId = !string.IsNullOrEmpty(ddlCustomerVillage.SelectedValue) ? Convert.ToInt32(ddlCustomerVillage.SelectedValue.ToString()) : 0;
                    ObjCustomer.TahsilId = !string.IsNullOrEmpty(ddlCustomerTaluka.SelectedValue) ? Convert.ToInt32(ddlCustomerTaluka.SelectedValue.ToString()) : 0;
                    ObjCustomer.DistrictId = !string.IsNullOrEmpty(ddlCustomerDistrict.SelectedValue) ? Convert.ToInt32(ddlCustomerDistrict.SelectedValue.ToString()) : 0;
                    ObjCustomer.Pincode = !string.IsNullOrEmpty(txtCustomerPinCode.Text) ? txtCustomerPinCode.Text.ToString() : string.Empty;
                    ObjCustomer.PhoneNumber = !string.IsNullOrEmpty(txtCustomerPhoneNumber.Text) ? txtCustomerPhoneNumber.Text.ToString() : "";
                    ObjCustomer.DateOfBirth = !string.IsNullOrEmpty(txtCustomerDOB.Text) ? txtCustomerDOB.Text.ToString() : string.Empty;
                    ObjCustomer.Email = !string.IsNullOrEmpty(txtCustomerEmail.Text) ? txtCustomerEmail.Text.ToString() : string.Empty;
                    ObjCustomer.SchoolName = !string.IsNullOrEmpty(txtCustomerSchoolname.Text) ? txtCustomerSchoolname.Text.ToString() : string.Empty;
                    ObjCustomer.SchoolTahsilId = !string.IsNullOrEmpty(ddlCustomerSchoolTaluka.SelectedValue) ? Convert.ToInt32(ddlCustomerSchoolTaluka.SelectedValue.ToString()) : 0;
                    ObjCustomer.SchoolDistrictId = !string.IsNullOrEmpty(ddlCusotmerSchoolDistrict.SelectedValue) ? Convert.ToInt32(ddlCusotmerSchoolDistrict.SelectedValue.ToString()) : 0;
                    ObjCustomer.SchoolPinCode = !string.IsNullOrEmpty(txtCustomerSchoolPinCode.Text) ? txtCustomerSchoolPinCode.Text.ToString() : string.Empty;

                    ObjCustomer.CustomerPanCard = !string.IsNullOrEmpty(txtCustomerPanCard.Text) ? txtCustomerPanCard.Text.ToString() : string.Empty;
                    //ObjCustomer.TotalYearOfService = !string.IsNullOrEmpty(txtCustTotalYearOfService.Text) ? txtCustTotalYearOfService.Text.ToString() : string.Empty;
                    ObjCustomer.EmploymentYear = !string.IsNullOrEmpty(txtCustEmploymentYear.Text) ? txtCustEmploymentYear.Text.ToString() : string.Empty;
                    //ObjCustomer.CustomerYear = !string.IsNullOrEmpty(txtCustomerYear.Text) ? txtCustomerYear.Text.ToString() : string.Empty;
                    ObjCustomer.Salary = !string.IsNullOrEmpty(txtCustomerSalary.Text) ? Convert.ToDecimal(txtCustomerSalary.Text.ToString()) : 0;
                    ObjCustomer.RetirementYear = !string.IsNullOrEmpty(txtCustRetirementDate.Text) ? txtCustRetirementDate.Text.ToString() : string.Empty;

                    ObjCustomer.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                    ObjCustomer.CreatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                    ObjCustomer.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                    ObjCustomer.UpdatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                    ObjCustomer.IsActive = true;

                    if (ObjCustomer.Insert())
                    {
                        //Customer Nominee Details
                        ObjNominee.NomineeId = !string.IsNullOrEmpty(hdnNomineeId.Value) ? Convert.ToInt32(hdnNomineeId.Value.ToString()) : 0;
                        ObjNominee.NomineeReferenceId = ObjCustomer.CustomerId > 0 ? ObjCustomer.CustomerId : 0;
                        ObjNominee.NomineeTypeId = Convert.ToInt32(clsEnum.NomineeType.Customer.GetHashCode().ToString());
                        ObjNominee.NamePrefix = !string.IsNullOrEmpty(ddlCustNomineePrefix.SelectedValue) ? ddlCustNomineePrefix.SelectedValue.ToString() : string.Empty;
                        ObjNominee.FirstName = !string.IsNullOrEmpty(txtCustnomineeFirstname.Text) ? txtCustnomineeFirstname.Text.ToString() : string.Empty;
                        ObjNominee.MiddleName = !string.IsNullOrEmpty(txtCustnomineeMiddlename.Text) ? txtCustnomineeMiddlename.Text.ToString() : string.Empty;
                        ObjNominee.LastName = !string.IsNullOrEmpty(txtCustnomineeLastname.Text) ? txtCustnomineeLastname.Text.ToString() : string.Empty;
                        ObjNominee.Address = !string.IsNullOrEmpty(txtCustNomineeAddress.Text) ? txtCustNomineeAddress.Text.ToString() : string.Empty;
                        ObjNominee.RelationWith = !string.IsNullOrEmpty(txtCustRelationWithNominee.Text) ? txtCustRelationWithNominee.Text.ToString() : string.Empty;
                        ObjNominee.VillageId = !string.IsNullOrEmpty(ddlCustNomineeVillage.Text) ? ddlCustNomineeVillage.Text.ToString() : string.Empty;
                        ObjNominee.TahsilId = !string.IsNullOrEmpty(ddlCustNomineeTaluka.SelectedValue) ? Convert.ToInt32(ddlCustNomineeTaluka.SelectedValue.ToString()) : 0;
                        ObjNominee.DistrictId = !string.IsNullOrEmpty(ddlCustNomineeDistrict.SelectedValue) ? Convert.ToInt32(ddlCustNomineeDistrict.SelectedValue.ToString()) : 0;
                        ObjNominee.PinCode = !string.IsNullOrEmpty(txtCustNomineePinCode.Text) ? txtCustNomineePinCode.Text.ToString() : string.Empty;
                        ObjNominee.PhoneNumber = !string.IsNullOrEmpty(txtCustNomineePhonenumber.Text) ? txtCustNomineePhonenumber.Text.ToString() : string.Empty;
                        ObjNominee.Occupation = !string.IsNullOrEmpty(txtCustNomineeOccupation.Text) ? txtCustNomineeOccupation.Text.ToString() : string.Empty;
                        ObjNominee.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                        ObjNominee.CreatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                        ObjNominee.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                        ObjNominee.UpdatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                        ObjNominee.IsActive = true;
                        ObjNominee.Insert();

                        if (!ddlCustomerType.SelectedValue.ToString().Equals(clsEnum.CustomerType.NaamMatra.GetHashCode().ToString()))
                        {
                            //Account Details
                            ObjAccounts.AccountId = !string.IsNullOrEmpty(hdnAccountId.Value) ? Convert.ToInt32(hdnAccountId.Value.ToString()) : 0;
                            ObjAccounts.AccountNumber = !string.IsNullOrEmpty(txtCustomerAccNumber.Text) ? txtCustomerAccNumber.Text.ToString() : string.Empty;
                            ObjAccounts.CustomerId = ObjCustomer.CustomerId > 0 ? ObjCustomer.CustomerId : 0;
                            ObjAccounts.OpeningDate = !string.IsNullOrEmpty(txtCustomerAccOpenDate.Text) ? txtCustomerAccOpenDate.Text.ToString() : string.Empty;
                            //ObjAccounts.AccountTypeId = !string.IsNullOrEmpty(ddlCustomerAccType.SelectedValue) ? Convert.ToInt32(ddlCustomerAccType.SelectedValue.ToString()) : 0;
                            ObjAccounts.AccountTypeId = Convert.ToInt32(clsEnum.AccountTypes.SavingAccount.GetHashCode().ToString());
                            ObjAccounts.OpeningBalance = !string.IsNullOrEmpty(txtCustomerOpeningBalance.Text) ? Convert.ToDecimal(txtCustomerOpeningBalance.Text.ToString()) : 0;
                            ObjAccounts.ShareBalance = !string.IsNullOrEmpty(txtCustomerShareAmt.Text) ? Convert.ToDecimal(txtCustomerShareAmt.Text.ToString()) : 0;
                            //ObjAccounts.KayamNidhiBalance = !string.IsNullOrEmpty(txtCustomerKayamnidhiBal.Text) ? Convert.ToDecimal(txtCustomerKayamnidhiBal.Text.ToString()) : 0;
                            //ObjAccounts.AccountBalance = !string.IsNullOrEmpty(txtCustomerAccountBal.Text) ? Convert.ToDecimal(txtCustomerAccountBal.Text.ToString()) : 0;
                            ObjAccounts.KayamNidhiBalance = 0;
                            ObjAccounts.AccountBalance = !string.IsNullOrEmpty(txtCustomerOpeningBalance.Text) ? Convert.ToDecimal(txtCustomerOpeningBalance.Text.ToString()) : 0;
                            ObjAccounts.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                            ObjAccounts.CreatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                            ObjAccounts.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                            ObjAccounts.UpdatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                            ObjAccounts.IsActive = true;
                            ObjAccounts.Insert();
                        }
                        else
                        {
                            //Account Details
                            ObjAccounts.AccountId = !string.IsNullOrEmpty(hdnAccountId.Value) ? Convert.ToInt32(hdnAccountId.Value.ToString()) : 0;
                            ObjAccounts.AccountNumber = string.Empty;
                            ObjAccounts.CustomerId = ObjCustomer.CustomerId > 0 ? ObjCustomer.CustomerId : 0;
                            ObjAccounts.OpeningDate = txtCustomerAccOpenDate.Text;
                            ObjAccounts.AccountTypeId = Convert.ToInt32(clsEnum.AccountTypes.SavingAccount.GetHashCode().ToString());
                            ObjAccounts.OpeningBalance = 0;
                            ObjAccounts.ShareBalance = 0;
                            ObjAccounts.KayamNidhiBalance = 0;
                            ObjAccounts.AccountBalance = 0;
                            ObjAccounts.CreatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                            ObjAccounts.CreatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                            ObjAccounts.UpdatedBy = Convert.ToInt32(AppSessions.GetSession(AppSessions.UDFSessionName._user_id.ToString()));
                            ObjAccounts.UpdatedDate = Convert.ToDateTime(txtCustomerAccOpenDate.Text);
                            ObjAccounts.IsActive = true;
                            ObjAccounts.Insert();
                        }

                        lblMessage.CssClass = "SuccessfulMessage";
                        lblMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavedSuccessfully");
                    }
                }
                else
                {
                    lblMessage.CssClass = "FailureMessage";
                    lblMessage.Text = (String)GetGlobalResourceObject("SharedResource", "LoginSessionExpire");
                }
                BindCustomerGrid();
            }
            catch
            {
                lblMessage.CssClass = "FailureMessage";
                lblMessage.Text = (String)GetGlobalResourceObject("SharedResource", "RecordSavingFailure");
            }
            finally
            {
                ObjCustomer = null;
                ObjNominee = null;
                ObjAccounts = null;
            }
        }
Esempio n. 39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvCustomerLoan_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ObjLoan = new clsLoan();
            dtLoan = new DataTable();
            clsComFun = new CommonFunctions();
            int iLoanId;
            string strValue = string.Empty;
            int intMonth = 0, intYear = 0;
            try
            {
                //BindLoanTypes();
                iLoanId = Convert.ToInt32(((Label)gvCustomerLoan.Rows[e.NewEditIndex].FindControl("lblLoanId")).Text);
                if (iLoanId > 0)
                {
                    ObjLoan.LoanId = iLoanId;
                    dtLoan = ObjLoan.LoanWithSearchFilters();
                    if (dtLoan.Rows.Count > 0)
                    {
                        //Fill Loan Details
                        hdnCustomerId.Value = dtLoan.Rows[0]["CustomerId"].ToString();
                        hdnLoanId.Value = dtLoan.Rows[0]["LoanID"].ToString();

                        //Loan Details
                        txtLoanDate.Text = dtLoan.Rows[0]["LoanDate"].ToString();
                        ddlLoanType.SelectedValue = dtLoan.Rows[0]["LoanTypeID"].ToString();
                        txtLoanAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["LoanAmount"]));
                        txtEmiAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["InstallmentAmount"]));

                        strValue = dtLoan.Rows[0]["LoanPeriod"].ToString();
                        intYear = (System.Convert.ToInt32(strValue) / 12);
                        ddlLoanYear.SelectedValue = intYear.ToString();
                        intMonth = (System.Convert.ToInt32(strValue) - (intYear * 12));
                        ddlLoanMonth.SelectedValue = intMonth.ToString();

                        ddlCustomerPastLoanEMI.SelectedValue = dtLoan.Rows[0]["LoanPaidTypeID"].ToString();
                        txtCustomerLoanPurpose.Text = dtLoan.Rows[0]["LoanReason"].ToString();
                        txtTotalLoanInstallmentAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["TotalInstallment"]));

                        BindCustomerDetails(Convert.ToInt64(dtLoan.Rows[0]["CustomerId"].ToString()));
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID1"]), "1");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID2"]), "2");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID3"]), "3");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID4"]), "4");

                        EnableDisabledControls(false);
                        ShowHideLoanGrid(false);
                        ShowHideLoanWitnessFields(false);
                    }
                }
            }
            catch (Exception) { }
            finally
            {
                ObjLoan = null;
                ObjCust = null;
                dtLoan = null;
            }
            ShowHideLoanGrid(false);
            EnableDisabledControls(false);
        }
        /// <summary>
        /// Added By : Himanshu Pandya  
        /// </summary>
        private void BindCustomerGrid()
        {
            ObjCustomer = new clsCustomer();
            dtCustomer = new DataTable();
            try
            {
                ShowHideCusotmerGrid(true);

                if (!string.IsNullOrEmpty(txtSearchCustomer.Text) && !string.IsNullOrEmpty(ddlCustomerSearch.SelectedValue))
                {
                    string strsearch = ddlCustomerSearch.SelectedValue.ToString();
                    switch (strsearch)
                    {
                        case "CustomerNo":
                            ObjCustomer.CustomerCode = txtSearchCustomer.Text.ToString();
                            break;
                        case "CusotmerName":
                            ObjCustomer.FirstName = txtSearchCustomer.Text.ToString();
                            break;
                        case "CusotmerDistrict":
                            ObjCustomer.DistrictName = txtSearchCustomer.Text.ToString();
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    ObjCustomer.CustomerCode = string.Empty;
                    ObjCustomer.FirstName = string.Empty;
                    ObjCustomer.DistrictName = string.Empty;
                }

                dtCustomer = ObjCustomer.SearcheAllCustomerWSearchFilters();
                if (dtCustomer.Rows.Count > 0)
                {
                    gvCustomer.DataSource = dtCustomer;
                }
                else
                {
                    gvCustomer.DataSource = null;
                }

                gvCustomer.PageSize = Convert.ToInt32(ddlPager.SelectedValue.ToString());
                gvCustomer.DataBind();
            }
            catch { }
            finally { ObjCustomer = null; dtCustomer = null; }
        }