Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            cust c1 = new cust()
            {
                ID = 101, Sal = 3000, Name = "Motilal"
            };
            cust c2 = new cust()
            {
                ID = 102, Sal = 5000, Name = "Shivalal"
            };
            cust c3 = new cust()
            {
                ID = 103, Sal = 7000, Name = "Amjt"
            };



            Dictionary <int, cust> custDictionary = new Dictionary <int, cust>();

            custDictionary.Add(c1.ID, c1);
            custDictionary.Add(c2.ID, c2);
            custDictionary.Add(c3.ID, c3);
            var custrecord = custDictionary[101];

            Console.WriteLine("Results{0},{1}", custrecord.Name, custrecord.Sal);

            foreach (KeyValuePair <int, cust> custkeyvalue in custDictionary)
            {
                Console.WriteLine("customer id = {0}", custkeyvalue.Key);
                var res = custkeyvalue.Value;
                Console.WriteLine("Name = {0}, sal{1}", res.Name, res.Sal);
            }

            Console.ReadLine();
        }
    public bool AddCustomer(cust ca)
    {
        LQDataContext ctxs = new LQDataContext();

        ctxs.custs.InsertOnSubmit(ca);
        ctxs.SubmitChanges();
        return(true);
    }
 public void UpdateCustomer(cust ca)
 {
     try
     {
         LQDataContext ctxx = new LQDataContext();
         var           q    = ctxx.custs.Where(d => d.id_cus == ca.id_cus).SingleOrDefault();
         q.cus_name = ca.cus_name;
         q.email    = ca.email;
         ctxx.SubmitChanges();
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            person p1 = new person();
            cust   c1 = new cust();

            p1.Name = "profound";
            string nm = p1.Name;

            p1.Address = "Pune";
            c1.Bill    = 200;
            c1.cid     = 001;
            cust c2 = new cust()
            {
                Bill = 201
            };
            cust c3 = new cust(202, "abc", "xyz");

            Console.WriteLine("c3: \t" + c3.Bill + "\t" + c3.Name + "\t" + c3.Address);
            Console.WriteLine("Bill no: {0}", c2.Bill);
            Console.WriteLine(nm + "\t" + p1.Address + "\t" + c1.Bill + "\t" + c1.cid);
            Console.ReadLine();
        }
 partial void Deletecust(cust instance);
 partial void Updatecust(cust instance);
 partial void Insertcust(cust instance);
Exemplo n.º 8
0
 partial void Deletecust(cust instance);
Exemplo n.º 9
0
 partial void Updatecust(cust instance);
Exemplo n.º 10
0
 partial void Insertcust(cust instance);
Exemplo n.º 11
0
    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 = rp.checkCus(cname, cemail);
                            if (n == -1)
                            {
                                c          = new cust();
                                c.cus_name = cname;
                                c.email    = cemail;
                                rp.AddCustomer(c);
                            }
                            else
                            {
                                c = rp.getCusbyID(n);
                            }
                            return(true);
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Name Too Long')", true);

                            return(false);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Email Too Long')", 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);
        }
    }
 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 = rp.checkCus(cname, cemail);
                         if (n==-1)
                         {
                             c = new cust();
                             c.cus_name = cname;
                             c.email = cemail;
                             rp.AddCustomer(c);
                         }
                         else
                         {
                             c = rp.getCusbyID(n);
                         }
                         return true;
                     }
                     else
                     {
                         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Name Too Long')", true);
                
                         return false;
                     }
                 }
                 else
                 {
                     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Email Too Long')", 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;    
     }
    
     
 }
    public void UpdateCustomer(cust ca)
    {
        try
        {
            LQDataContext ctxx = new LQDataContext();
            var q = ctxx.custs.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 AddCustomer(cust ca)
 {
     LQDataContext ctxs = new LQDataContext();
     ctxs.custs.InsertOnSubmit(ca);
     ctxs.SubmitChanges();
     return true;
 }