コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Customerdetails cs = new Customerdetails();

            cs.name        = name.Text;
            cs.email       = email.Text;
            cs.password    = password.Text;
            cs.address     = address.Text;
            cs.dob         = DateTime.Parse(dob.Text);
            cs.phonenumber = phone.Text;
            cs.gender      = gender.Text;
            cs.ssntype     = ssntype.Text;
            cs.ssnnumber   = ssnnumber.Text;


            CustomerBO cb  = new CustomerBO();
            string     msg = cb.insertcustomer(cs);

            if (!msg.Equals("Success"))
            {
                Label1.Text     = msg;
                HyperLink1.Text = "Login";
                //Response.Redirect("Webform1.aspx");
            }
            else
            {
                Label1.Text = "Please register again";
            }
            //custid.Text = c.ToString();
            Cache["customer"] = cs;
        }
コード例 #2
0
ファイル: CustomerBO.cs プロジェクト: dheerajkumar96/Projects
        public string insertcustomer(Customerdetails cs)
        {
            List <SqlParameter> V = new List <SqlParameter>();
            SqlParameter        p = null;
            int CustId            = DBOperations.getCustID();

            p = new SqlParameter("@custId", CustId);
            V.Add(p);
            p = new SqlParameter("@name", cs.name);
            V.Add(p);
            p = new SqlParameter("@email", cs.email);
            V.Add(p);
            p = new SqlParameter("@password", cs.password);
            V.Add(p);
            p = new SqlParameter("@dob", cs.dob);
            V.Add(p);
            p = new SqlParameter("@address", cs.address);
            V.Add(p);
            p = new SqlParameter("@phonenumber", cs.phonenumber);
            V.Add(p);
            p = new SqlParameter("@gender", cs.gender);
            V.Add(p);
            p = new SqlParameter("@ssntype", cs.ssntype);
            V.Add(p);
            p = new SqlParameter("@ssnnumber", cs.ssnnumber);
            V.Add(p);
            p           = new SqlParameter("@st", SqlDbType.NVarChar, 100);
            p.Direction = ParameterDirection.Output;
            V.Add(p);
            string msg = DBOperations.insert("sp_customerdetails2", V);

            if (msg.Equals("Success"))
            {
                return("Success Your CustomerId is " + CustId.ToString());
            }
            else
            {
                return(msg);
            }


            // return cd;
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] != null)
     {
         if (!IsPostBack)
         {
             CustomerBO      C  = new CustomerBO();
             Customerdetails Cd = C.retriveCustomer(Session["User"].ToString());
             TextBox1.Text   = Cd.CustId;
             name1.Text      = Cd.name;
             email1.Text     = Cd.email;
             dob1.Text       = Cd.dob.ToString();
             address1.Text   = Cd.address;
             phone1.Text     = Cd.phonenumber;
             gender1.Text    = Cd.gender;
             ssntype1.Text   = Cd.ssntype;
             ssnnumber1.Text = Cd.ssnnumber;
         }
     }
 }
コード例 #4
0
        public static Customerdetails retrievecustomer(string username)
        {
            Customerdetails c = null;

            try
            {
                Con.Open();
                cmd             = new SqlCommand("sp_editcustomer", Con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@username", username);
                SqlDataReader R = cmd.ExecuteReader();

                while (R.Read())
                {
                    c        = new Customerdetails();
                    c.CustId = R[0].ToString();
                    c.name   = R[1].ToString();
                    c.email  = R[2].ToString();
                    // c.password = R[4].ToString();
                    c.dob         = DateTime.Parse(R[3].ToString());
                    c.address     = R[4].ToString();
                    c.phonenumber = R[5].ToString();
                    c.gender      = R[6].ToString();
                    c.ssntype     = R[7].ToString();
                    c.ssnnumber   = R[8].ToString();
                }
            }
            catch (Exception E)
            {
                throw E;
            }
            finally
            {
                Con.Close();
            }
            return(c);
        }
コード例 #5
0
ファイル: CustomerBO.cs プロジェクト: dheerajkumar96/Projects
        public Customerdetails retriveCustomer(string username)
        {
            Customerdetails C = DBOperations.retrievecustomer(username);

            return(C);
        }