protected void AddCustomerSubmit_Click(object sender, EventArgs e)
    {
        //DropDownListProjectName
        DLCustomer ObjDLCustomer = new DLCustomer();
        ELCustomer ObjElCustomer = new ELCustomer();

        ObjElCustomer.Name      = TextBoxCustomerName.Text;
        ObjElCustomer.projectId = Guid.Parse(DropDownListProjectName.Text);

        ObjElCustomer.Creator    = Id;
        ObjElCustomer.CreatedAt  = DateTime.Now;
        ObjElCustomer.Modifier   = ObjElCustomer.Creator;
        ObjElCustomer.ModifiedAt = ObjElCustomer.CreatedAt;

        ObjDLCustomer.AddCustomer(ObjElCustomer, ObjConetion.connectionstring);
        // ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Inserted Customer Successfully');Window.location ='CustomerViewPage.aspx';", true);
        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Inserted Customer Successfully');window.location ='CustomerViewPage.aspx';", true);
    }
Example #2
0
        public ActionResult Login()
        {
            try
            {
                bal = new BLCustomer();
                DLCustomer dlcustomer = new DLCustomer();
                dlcustomer.Firstname = Request["Firstname"];

                dlcustomer.Lastname      = Request["Lastname"];
                dlcustomer.GoogleId      = Request["GoogleID"];
                dlcustomer.Email         = Request["Email"];
                Session["LoginCustomer"] = dlcustomer.Firstname + " " + dlcustomer.Lastname;

                dlcustomer.Password = null;


                int val = bal.Signup(dlcustomer, "Insert");

                Session["CustomerId"] = bal.GPlusCustomer();
                if (Session["CustomerId"] != null)
                {
                    int CustomerId = Convert.ToInt32(Session["CustomerId"]);

                    int CartId = bal.CartCustomerExist(CustomerId);
                    if (CartId > 0)
                    {
                        List <DLProducts> lst = bal.CartItem(CartId);
                        int count             = 0;
                        foreach (var v in lst)
                        {
                            count++;
                        }
                        Session["CartCount"] = count;
                    }
                }

                return(Redirect("/Customer/Home"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public ActionResult Signup(DLCustomer cust, string save)
        {
            try
            {
                if (cust.CustomerId == 0)
                {
                    if (ModelState.IsValid)
                    {
                        return(View(cust));
                    }
                }
                else
                {
                    if (!ModelState.IsValid)
                    {
                        return(View(cust));
                    }
                }
                cust.Password = SHA1.Encode(cust.Password.ToString());

                if (!String.IsNullOrEmpty(save))
                {
                    cust.GoogleId = null;
                    int i = bal.Signup(cust, "Insert");
                }
                else
                {
                    cust.Password = null;
                    int i = bal.Signup(cust, "Update");
                }

                return(Redirect("/Customer/Home"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        public int Signup(DLCustomer customer, string action)
        {
            int i = 0;

            try
            {
                SqlCommand cmd = new SqlCommand("StoredProcCustomer", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id", customer.CustomerId);
                cmd.Parameters.AddWithValue("@firstname", customer.Firstname.ToString());
                cmd.Parameters.AddWithValue("@lastname", customer.Lastname.ToString());
                cmd.Parameters.AddWithValue("@email", customer.Email.ToString());
                cmd.Parameters.AddWithValue("@googleId", customer.GoogleId);
                cmd.Parameters.AddWithValue("@password", customer.Password);
                cmd.Parameters.AddWithValue("@isactive", 1);
                cmd.Parameters.AddWithValue("@Action", action);

                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                i = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
            return(i);
        }
Example #5
0
 public void Dispose()
 {
     oDLCustomer = null;
 }
Example #6
0
 public BLCustomer()
 {
     oDLCustomer = new DLCustomer();
 }