Example #1
0
    public bool AddCustomer(customer_detail ca)
    {
        LQDataContext ctxs = new LQDataContext();

        ctxs.customer_details.InsertOnSubmit(ca);
        ctxs.SubmitChanges();
        return(true);
    }
Example #2
0
 public void UpdateCustomer(customer_detail ca)
 {
     try
     {
         LQDataContext ctxx = new LQDataContext();
         var           q    = ctxx.customer_details.Where(d => d.id_cus == ca.id_cus).SingleOrDefault();
         q.cus_name = ca.cus_name;
         q.email    = ca.email;
         ctxx.SubmitChanges();
     }
     catch (Exception ex)
     {
     }
 }
    public bool add_cus()
    {
        string cname  = txtCusName.Text;
        string cemail = txtEmail.Text;

        if (ck.checkstringnull(cname))
        {
            if (ck.checkstringnull(cemail))
            {
                if (ck.checkEmail(cemail))
                {
                    if (ck.checkstring(cemail, 100))
                    {
                        if (ck.checkstring(cname, 50))
                        {
                            int n = cl.checkCus(cname, cemail);
                            if (n == -1)
                            {
                                c          = new customer_detail();
                                c.cus_name = cname;
                                c.email    = cemail;
                                cl.AddCustomer(c);
                            }
                            else
                            {
                                c = cl.getCusbyID(n);
                            }
                            return(true);
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Name exceeds the required length')", true);

                            return(false);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Email exceeds the required length')", true);

                        return(false);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Email Is Incorrect')", true);
                    return(false);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Type Your Email')", true);
                return(false);
            }
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Type Your Name')", true);
            return(false);
        }
    }