Esempio n. 1
0
        public string GetAllCustomers(int pageNumber, string searchTerm, int numberOfRecords, int rating = 0)
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetAllCustomers(pageNumber, searchTerm, numberOfRecords, rating);
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
        public string GetAllCustomers()
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetAllCustomers(1, string.Empty, 10000, 0, "0");
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
Esempio n. 3
0
        public string GetCustomerExcelReport(int pageNumber, string searchTerm, int numberOfRecords, int rating = 0)
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result    = obj.GetCustomerExcel(pageNumber, searchTerm, numberOfRecords, rating);
            var directory = HttpContext.Current.Server.MapPath("~/");
            var filename  = Path.Combine(directory, "Download", "Customer.xlsx");

            File.WriteAllBytes(filename, result);
            return(new JavaScriptSerializer().Serialize(filename));
        }
Esempio n. 4
0
        private void BindCustomer()
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetAllCustomerNameAndId();

            ddlCustomer.DataSource     = result;
            ddlCustomer.DataTextField  = "Name";
            ddlCustomer.DataValueField = "CustomerId";
            ddlCustomer.DataBind();
            ddlCustomer.Items.Insert(0, new ListItem("New Student", "0"));
        }
Esempio n. 5
0
        private void BindData(int customerId)
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetCustomerDetailsById(customerId);

            if (result != null)
            {
                lblName.Text    = result.Name;
                lblAddress.Text = result.Address;
                lblEmail.Text   = result.Email;
                lblMobile.Text  = result.Phone;
                lblPIN.Text     = result.PinCode;
                lblRating.Text  = result.Rating.ToString();
            }
        }
 public string GetCustomerExcelReport(int pageNumber, string searchTerm, int numberOfRecords, int rating = 0)
 {
     try
     {
         CustomerBusinessActions obj = new CustomerBusinessActions();
         var result    = obj.GetCustomerExcel(pageNumber, searchTerm, numberOfRecords, rating);
         var directory = HttpContext.Current.Server.MapPath("~/");
         var filename  = Path.Combine(directory, "Download", "Student.xlsx");
         File.WriteAllBytes(filename, result);
         return(new JavaScriptSerializer().Serialize(filename));
     }
     catch (Exception ex)
     {
         throw new SoapException(ex.Message, SoapException.ServerFaultCode, Context.Request.Url.AbsoluteUri);
     }
 }
Esempio n. 7
0
        public bool DeleteCustomer(string customerId)
        {
            UserModel objUser = new UserModel();
            int       userID  = 0;

            if (HttpContext.Current.Session["User"] != null)
            {
                objUser = (UserModel)Session["User"];
                userID  = objUser.UserId;
            }


            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.DeleteCustomer(customerId, userID);

            return(result);
        }
        public string GetAllCustomers()
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetAllCustomers(1, string.Empty, 10000, 0);
            EnquiryBusinessLogic obj1 = new EnquiryBusinessLogic();
            var enq  = obj1.GetAllEnquiries("all", 1, "", 10000, "", "").Where(x => x.ExistingCustomerId == 0).ToList();
            var cust = result.Select(x => new CustomerEnquiryComb {
                Id = x.CustomerId, Name = x.Name, Type = "C"
            }).ToList();
            var en = enq.Select(x => new CustomerEnquiryComb {
                Id = x.EnquiryId, Name = x.Name, Type = "E"
            });
            var combined = cust.Union(en);
            var json     = new JavaScriptSerializer().Serialize(combined);

            return(json);
        }
Esempio n. 9
0
        public string GetAllCenters()
        {
            UserModel objUser  = new UserModel();
            string    centerId = "0";

            if (HttpContext.Current.Session["User"] != null)
            {
                objUser = (UserModel)Session["User"];
                if (objUser.RoleId != 1)
                {
                    centerId = objUser.CenterId.ToString();
                }
            }
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetAllCenter(centerId);
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
Esempio n. 10
0
 protected void ddlCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlCustomer.SelectedValue == "0")
     {
         txtAddress.InnerText  = "";
         txtContactNumber.Text = "";
         txtEmail.Text         = "";
         txtName.Text          = "";
     }
     else
     {
         CustomerBusinessActions obj = new CustomerBusinessActions();
         var result = obj.GetCustomerDetailsById(Convert.ToInt32(ddlCustomer.SelectedValue));
         txtAddress.InnerText  = result.Address;
         txtContactNumber.Text = result.Phone;
         txtEmail.Text         = result.Email;
         txtName.Text          = result.Name;
     }
 }
Esempio n. 11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            UserModel objUser = new UserModel();

            if (Session["User"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                objUser = (UserModel)Session["User"];
                if (!objUser.IsValidUser)
                {
                    Response.Redirect("Login.aspx");
                }
            }

            int enquiryId = 0;

            if (Request.QueryString["EnquiryID"] != null && Request.QueryString["EnquiryID"].ToString() != string.Empty)
            {
                try
                {
                    enquiryId = Convert.ToInt32(Request.QueryString["EnquiryID"]);
                }
                catch (Exception ex)
                {
                }
            }


            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.AddCustomer(txtName.Text, txtContactNumber.Text, txtAddress.InnerText, txtEmail.Text, txtPinCode.Text, ddlRating.SelectedValue, objUser.UserId.ToString(), enquiryId, ddlCourse.SelectedValue);

            if (result == true)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SuccessRedirect", "alert('Student Added Successsfully'); window.location.href = 'Customers.aspx';", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorRedirect", "alert('Something Went wrong. Please try again later');", true);
            }
        }
Esempio n. 12
0
        public string GetAllCustomers(int pageNumber, string searchTerm, int numberOfRecords, int rating = 0)
        {
            UserModel objUser  = new UserModel();
            string    centerId = "0";

            if (HttpContext.Current.Session["User"] != null)
            {
                objUser = (UserModel)Session["User"];
                if (objUser.RoleId != 1)
                {
                    centerId = objUser.CenterId.ToString();
                }
            }
            CustomerBusinessActions obj = new CustomerBusinessActions();
            var result = obj.GetAllCustomers(pageNumber, searchTerm, numberOfRecords, rating, centerId);
            var json   = new JavaScriptSerializer().Serialize(result);

            return(json);
        }
Esempio n. 13
0
        private void BindCourse()
        {
            CustomerBusinessActions obj = new CustomerBusinessActions();
            UserModel objUser           = new UserModel();
            string    centerId          = "0";

            if (HttpContext.Current.Session["User"] != null)
            {
                objUser = (UserModel)Session["User"];
                if (objUser.RoleId != 1)
                {
                    centerId = objUser.CenterId.ToString();
                }
            }
            var result = obj.GetAllCourse(centerId);

            ddlCourse.DataSource     = result;
            ddlCourse.DataTextField  = "Name";
            ddlCourse.DataValueField = "Id";
            ddlCourse.DataBind();
            ddlCourse.Items.Insert(0, new ListItem("Select", "0"));
        }