protected void grdCustomer_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = int.Parse(e.CommandArgument.ToString());
            Session.Add("rowIndex", rowIndex);
            ManageCustomer custObj = new ManageCustomer();
            DataTable dt = custObj.getACustomer(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString, rowIndex);

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                txtCustomerName.Value = DBUtility.readDBString(dr, "Customer_name");
                txtCustomerAddress.Value = DBUtility.readDBString(dr, "Address_Line_1");
                txtCustomerAddressLine2.Value = DBUtility.readDBString(dr, "Address_Line_2");
                txtCustomerCity.Value = DBUtility.readDBString(dr, "City");
                txtCustomerCode.Value = DBUtility.readDBString(dr, "Code");
                txtCustomerTelephone.Value = DBUtility.readDBString(dr, "telephone_1");
                txtCustomerTelephone2.Value = DBUtility.readDBString(dr, "telephone_2");
                txtCustomerCellphone.Value = DBUtility.readDBString(dr, "Cellphone");
                txtCustomerFax.Value = DBUtility.readDBString(dr, "fax");
                txtCustomerEmail.Value = DBUtility.readDBString(dr, "email");
                txtCustomerRepresentative.Value = DBUtility.readDBString(dr, "Representative");
                txtCustomerVATNumber.Value = DBUtility.readDBString(dr, "VAT_Number");
                txtCustomerCKNumber.Value = DBUtility.readDBString(dr, "CK_number");
                if (dr["wholesale_customer"] != null && !dr.IsNull("wholesale_customer"))
                {
                    chkCustomerWholesaleCustomer.Checked = Convert.ToBoolean(dr["wholesale_customer"]);
                }
                if (dr["Disable"] != null && !dr.IsNull("Disable"))
                {
                    chkBoxCustomerDisable.Checked = Convert.ToBoolean(dr["Disable"]);
                }
            }
        }
Exemple #2
0
        public async Task DeleteBranch(BranchCreateModel data)
        {
            try
            {
                switch (data.companyType)
                {
                case "MSP":
                    await Task.Run(() => ManageMSP.DeleteMSPLocationBranch(data.id, "Branch"));

                    break;

                case "Customer":
                    await Task.Run(() => ManageCustomer.DeleteCustomerLocationBranch(data.id, "Branch"));

                    break;

                case "Supplier":
                    await Task.Run(() => ManageSupplier.DeleteSupplierBranchLocation(data.id, "Branch"));

                    break;
                }

                await Task.Run(() => ManageBranch.DeleteBranch(data.id));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        public async Task <BranchCreateModel> CreateBranch(BranchCreateModel data)
        {
            try
            {
                BranchCreateModel model      = null;
                tblBranch         dataBranch = await Task.Run(() => ManageBranch.InsertBranch(data.ConvertTotblBranch()));

                model         = (await Task.Run(() => ManageBranch.GetBranchDetails(dataBranch.ID))).ConvertToBranch();
                data.branchId = model.id;

                switch (data.companyType)
                {
                case "MSP":
                    tblMSPLocationBranch dataMSP = await Task.Run(() => ManageMSP.InsertMSPLocationBranch(data.ConvertTotblMSPLocationBranch()));

                    break;

                case "Customer":
                    tblCustomerLocationBranch dataCustomer = await Task.Run(() => ManageCustomer.InsertCustomerLocationBranch(data.ConvertTotblCustomerLocationBranch()));

                    break;

                case "Supplier":
                    tblSupplierLocationBranch dataSupplier = await Task.Run(() => ManageSupplier.InsertSupplierLocationBranch(data.ConvertTotblSupplierLocationBranch()));

                    break;
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();

        c.LastName      = txtLastName.Text;
        c.FirstName     = txtFirstName.Text;
        c.Email         = txtEmail.Text;
        c.LicenseNumber = txtLicense.Text;
        c.VehicleMake   = txtMake.Text;
        c.VehicleYear   = txtYear.Text;
        c.PlainPassword = txtPassword.Text;


        ManageCustomer mc = new ManageCustomer();

        try
        {
            mc.WriteCustomer(c);
            lblError.Text = "Thanks for registering";
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
        protected void btnSearchCustomers_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (txtSearchCustomers.Value.Length > 0)
                {
                    ManageCustomer manager = new ManageCustomer();
                    var customerList = manager.searchCustomer(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString, txtSearchCustomers.Value);
                    if (customerList != null && customerList.Rows.Count > 0)
                    {
                        divCustomersNothingFound.Visible = false;
                        if (Session["SEARCH_CUSTOMERS"] != null)
                        {
                            Session.Remove("SEARCH_CUSTOMERS");
                        }
                        Session.Add("SEARCH_CUSTOMERS", customerList);
                        grdCustomers.DataSource = Session["SEARCH_CUSTOMERS"];
                        grdCustomers.DataBind();
                    }
                    else
                    {
                        divCustomersNothingFound.Visible = true;
                        grdCustomers.DataSource = null;
                        grdCustomers.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
Exemple #6
0
        public async Task <LocationCreateModel> CreateLocation(LocationCreateModel data)
        {
            try
            {
                LocationCreateModel model        = null;
                tblLocation         dataLocation = await Task.Run(() => ManageLocation.InsertLocation(data.ConvertTotblLocation()));

                model           = (await Task.Run(() => ManageLocation.GetLocationDetails(dataLocation.ID))).ConvertToLocation();
                data.locationId = model.id;

                switch (data.companyType)
                {
                case "MSP":
                    tblMSPLocationBranch dataMSP = await Task.Run(() => ManageMSP.InsertMSPLocationBranch(data.ConvertTotblMSPLocationBranch()));

                    break;

                case "Customer":
                    tblCustomerLocationBranch dataCustomer = await Task.Run(() => ManageCustomer.InsertCustomerLocationBranch(data.ConvertTotblCustomerLocationBranch()));

                    break;

                case "Supplier":
                    tblSupplierLocationBranch dataSupplier = await Task.Run(() => ManageSupplier.InsertSupplierLocationBranch(data.ConvertTotblSupplierLocationBranch()));

                    break;
                }

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void onClicksubManageNewCustomer(object sender, RoutedEventArgs e)
        {
            if (RibbonContainer.SelectedItem is RibbonTab)
            {
                RibbonTab selectedTab = (RibbonTab)RibbonContainer.SelectedItem;
                selectedTab.Items.Clear();
                selectedTab.Header = "Customer";

                selectedTab.Margin = new Thickness(0, 0, -200, -727);

                RibbonGroup ManageNewCustomerTabGroup = new RibbonGroup();
                ManageNewCustomerTabGroup.Background = (Brush)FindResource("Sales");

                ContextMenu contextMenu   = new ContextMenu();
                MenuItem    closeMenuItem = new MenuItem();
                closeMenuItem.Header = "Close";
                closeMenuItem.Click += MenuItem_Click_1;
                contextMenu.Items.Add(closeMenuItem);
                ManageNewCustomerTabGroup.ContextMenu = contextMenu;

                UserControl ManageNewCustomerTabContent = new ManageCustomer();

                ManageNewCustomerTabGroup.Items.Add(ManageNewCustomerTabContent);
                selectedTab.Items.Add(ManageNewCustomerTabGroup);
            }
        }
        protected void btnSaveCustomer_ServerClick(object sender, EventArgs e)
        {
            CustomerObject obj = new CustomerObject();

            obj.Customer_NameProp = txtCustomerName.Value;
            obj.Address_Line_1Prop = txtCustomerAddress.Value;
            obj.Address_Line_2Prop = txtCustomerAddressLine2.Value;
            obj.CityProp = txtCustomerCity.Value;
            obj.CodeProp = txtCustomerCode.Value;
            obj.Telephone1Prop = txtCustomerTelephone.Value;
            obj.Telephone2Prop = txtCustomerTelephone2.Value;
            obj.FaxProp = txtCustomerFax.Value;
            obj.Cellphone1Prop = txtCustomerCellphone.Value;
            obj.EmailProp = txtCustomerEmail.Value;
            obj.RepresentativeProp = txtCustomerRepresentative.Value;
            obj.VAT_NumberProp = txtCustomerVATNumber.Value;
            obj.CK_NumberProp = txtCustomerCKNumber.Value;
            obj.DisableProp = chkBoxCustomerDisable.Checked;
            obj.Wholesale_CustomerProp = chkCustomerWholesaleCustomer.Checked;

            ManageCustomer customerObj = new ManageCustomer();

            bool success = customerObj.insert(obj,ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString);

            if (success)
            {
                divSuccess.Visible = true;
            }
            else
                divFailure.Visible = true;
        }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();
        c.LastName = txtLastName.Text;
        c.FirstName = txtFirstName.Text;
        c.Email = txtEmail.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();
        mc.WriteCustomer(c);

        Response.Redirect("SignIn.aspx");
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();
        c.LastName = txtLastName.Text;
        c.FirstName = txtFirstName.Text;
        c.Email = txtEmail.Text;
        c.LicenseNumber = txtLicense.Text;
        c.VehicleMake = txtMake.Text;
        c.VehicleYear = txtYear.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();
        mc.WriteCustomer(c);

        lblError.Text = "Thank you for registering, " + c.FirstName;
    }
Exemple #11
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();
        c.FirstName = txtFirstName.Text;
        c.LastName = txtLastName.Text;
        c.Email = txtEmail.Text;
        c.Street = txtStreet.Text;
        c.Apartment = txtApartment.Text;
        c.City = txtCity.Text;
        c.State = txtState.Text;
        c.Zip = txtZip.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();

            mc.WriteCustomer(c);
            Response.Redirect("LoginForm.aspx");
    }
Exemple #12
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();

        c.FirstName     = txtFirstName.Text;
        c.LastName      = txtLastName.Text;
        c.Email         = txtEmail.Text;
        c.Street        = txtStreet.Text;
        c.Apartment     = txtApartment.Text;
        c.City          = txtCity.Text;
        c.State         = txtState.Text;
        c.Zip           = txtZip.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();

        mc.WriteCustomer(c);
        Response.Redirect("LoginForm.aspx");
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();
        c.FirstName = txtFirstName.Text;
        c.LastName = txtLastName.Text;
        c.Email = txtEmail.Text;
        c.Street = txtStreet.Text;
        c.Apartment = txtApartment.Text;
        c.City = txtCity.Text;
        c.State = txtState.Text;
        c.Zip = txtZip.Text;
        c.Donation = txtDonation.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();

        {
            mc.WriteCustomer(c);
            lblError.Text = "Thanks for registering.";
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();

        c.FirstName     = txtFirstName.Text;
        c.LastName      = txtLastName.Text;
        c.Email         = txtEmail.Text;
        c.Street        = txtStreet.Text;
        c.Apartment     = txtApartment.Text;
        c.City          = txtCity.Text;
        c.State         = txtState.Text;
        c.Zip           = txtZip.Text;
        c.Donation      = txtDonation.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();

        {
            mc.WriteCustomer(c);
            lblError.Text = "Thanks for registering.";
        }
    }
Exemple #15
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Customer c = new Customer();
        c.LastName = txtLastName.Text;
        c.FirstName = txtFirstName.Text;
        c.LicenseNumber = txtLicense.Text;
        c.Email = txtEmail.Text;
        c.VehicleMake = txtMake.Text;
        c.VehicleYear = txtYear.Text;
        c.PlainPassword = txtPassword.Text;

        ManageCustomer mc = new ManageCustomer();
        try
        {
            mc.WriteCustomer(c);
            lblError.Text = "Thanks for registering";

        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
Exemple #16
0
        public async Task <List <LocationCreateModel> > GetLocations(LocationCreateModel data)
        {
            try
            {
                List <LocationCreateModel> res     = null;
                List <tblLocation>         resData = null;
                long Id = data != null?Convert.ToInt64(data.companyId) : 0;

                switch (data.companyType)
                {
                case "MSP":
                    long id = Convert.ToInt64(ConfigurationManager.AppSettings["MSP_ID"]);
                    Id      = id != null ? id : Id;
                    resData = await Task.Run(() => ManageMSP.GetMSPLocation(Id));

                    break;

                case "Customer":
                    resData = await Task.Run(() => ManageCustomer.GetCustomerLocation(Id));

                    break;

                case "Supplier":
                    resData = await Task.Run(() => ManageSupplier.GetSupplierLocation(Id));

                    break;
                }
                res = resData.Select(a => a.ConvertToLocation()).ToList();

                return(res);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #17
0
        public async Task <List <LocationCreateModel> > GetCustomerLocationBranches(LocationCreateModel data)
        {
            try
            {
                List <LocationCreateModel>       res     = null;
                List <tblCustomerLocationBranch> resData = null;
                long Id = data != null?Convert.ToInt64(data.companyId) : 0;

                switch (data.companyType)
                {
                case "Customer":
                    resData = await Task.Run(() => ManageCustomer.GetCustomerLocationBranches(Id));

                    break;
                }
                res = resData.Select(a => a.ConvertToCustomerLocationBranch()).ToList();

                return(res);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #18
0
        public async Task <List <BranchCreateModel> > GetBranchs(LocationBranchModel data)
        {
            try
            {
                List <BranchCreateModel> model    = null;
                List <tblBranch>         resModel = null;
                long Id = data != null?Convert.ToInt64(data.companyId) : 0;

                switch (data.companyType)
                {
                case "MSP":
                    long id = Convert.ToInt64(ConfigurationManager.AppSettings["MSP_ID"]);
                    Id       = id != null ? id : Id;
                    resModel = await Task.Run(() => ManageMSP.GetMSPBranches(Id, data.locationId));

                    break;

                case "Customer":
                    resModel = await Task.Run(() => ManageCustomer.GetCustomerBranches(Id, data.locationId));

                    break;

                case "Supplier":
                    resModel = await Task.Run(() => ManageSupplier.GetSupplierBranches(Id, data.locationId));

                    break;
                }
                model = resModel.Select(a => a.ConvertToBranch()).ToList();

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #19
0
        private void ShowAllCustomer()
        {
            mngCustomer = new ManageCustomer(ConnectioString);
            List <CustomerModel> custList = mngCustomer.GetAllCustomer();

            if (radioName.Checked && !string.IsNullOrEmpty(txtSearch.Text))
            {
                custList = custList.FindAll(cust => cust.CustomerName.Contains(txtSearch.Text));
            }
            if (radioMobile.Checked && !string.IsNullOrEmpty(txtSearch.Text))
            {
                custList = custList.FindAll(cust => cust.MobileNo.Equals(txtSearch.Text));
            }
            if (chkSearchActiveUser.Checked)
            {
                custList = custList.FindAll(cust => cust.Diactivate);
            }
            else
            {
                custList = custList.FindAll(cust => !cust.Diactivate);
            }
            gridCust.DataSource = custList;
            gridCust.ClearSelection();
        }
        protected void invoiceLoad(object sender, EventArgs e)
        {
            try
            {
                txtDate.Value = DateTime.Now.Date.ToShortDateString();

                //set customer details
                if (Session["TRANSACTION_CUSTOMER"] != null)
                {
                    var customer = new ManageCustomer().getACustomer(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString, int.Parse(Session["TRANSACTION_CUSTOMER"].ToString()));
                    if (customer.Rows.Count > 0)
                    {
                        DataRow dr = customer.Rows[0];
                        txtCustomerName.Value = DBUtility.readDBString(dr, "Customer_name");
                        txtAddressLine1.Value = DBUtility.readDBString(dr, "Address_Line_1");
                        txtAddressLine2.Value = DBUtility.readDBString(dr, "Address_Line_2");
                        txtPhone.Value = DBUtility.readDBString(dr, "telephone_1");
                        txtEmail.Value = DBUtility.readDBString(dr, "email");
                    }

                }

                //set vehicle details
                if (Session["TRANSACTION_VEHICLES"] != null)
                {
                    var vehicles = (DataTable)Session["TRANSACTION_VEHICLES"];
                    if (vehicles != null && vehicles.Rows.Count > 0)
                    {
                        grdTransactionVehicles.DataSource = vehicles;
                        grdTransactionVehicles.DataBind();
                    }
                }

            }
            catch (Exception ex)
            {

            }
        }
 protected void grdCustomer_Load(object sender, EventArgs e)
 {
     ManageCustomer customerObj = new ManageCustomer();
     grdCustomer.DataSource = customerObj.getCustomerInfo(ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString);
     grdCustomer.DataBind();
 }