示例#1
0
        public bool Register(string _sFullName, int sex, DateTime ngaysinh, string _Address, string _Phone, string cityId, string _Pass, string _Email)
        {
            try
            {
                ESHOP_CUSTOMER user = new ESHOP_CUSTOMER();

                user.CUSTOMER_FULLNAME = _sFullName;
                user.CUSTOMER_SEX      = sex;
                if (ngaysinh != DateTime.MinValue)
                {
                    user.CUSTOMER_BIRTHDAY = ngaysinh;
                }
                user.CUSTOMER_ADDRESS = _Address;
                user.CUSTOMER_PHONE1  = _Phone;
                user.CUSTOMER_FIELD1  = cityId;

                user.CUSTOMER_PW          = _Pass;
                user.CUSTOMER_EMAIL       = _Email;
                user.CUSTOMER_PUBLISHDATE = DateTime.Now;
                user.CUSTOMER_SHOWTYPE    = 1;
                db.ESHOP_CUSTOMERs.InsertOnSubmit(user);
                db.SubmitChanges();
                Load_All_Cuss(_Email);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#2
0
 public bool Register(string _sFullName, string _Email, string _Pass, string _code, string _phone, string _add, int sex, string _idcity, string _iddistrict, DateTime _birth)
 {
     if (!Check_email(_Email))
     {
         ESHOP_CUSTOMER user = new ESHOP_CUSTOMER();
         user.CUSTOMER_EMAIL       = _Email;
         user.CUSTOMER_PW          = _Pass;
         user.CUSTOMER_FULLNAME    = _sFullName;
         user.CUSTOMER_PUBLISHDATE = DateTime.Now;
         user.CUSTOMER_PHONE1      = _phone;
         user.CUSTOMER_ADDRESS     = _add;
         user.CUSTOMER_FIELD1      = _idcity;
         user.CUSTOMER_FIELD2      = _iddistrict;
         user.CUSTOMER_FIELD3      = sex.ToString();
         user.CUSTOMER_UPDATE      = _birth;
         user.CUSTOMER_SHOWTYPE    = 0;
         user.CUSTOMER_FIELD5      = _code;
         user.CUSTOMER_TYPE        = 0;
         db.ESHOP_CUSTOMERs.InsertOnSubmit(user);
         db.SubmitChanges();
         Load_All_Cuss(_Email);
         return(true);
     }
     return(false);
 }
示例#3
0
        public int insertCustomerNTV(string emailuser, string pass, string fullname, DateTime birthday, int sex, int tthonnhan, string address, int cityId, string phone, string email)
        {
            try
            {
                ESHOP_CUSTOMER user = new ESHOP_CUSTOMER();
                user.CUSTOMER_UN_EMAIL = emailuser;
                user.CUSTOMER_PW       = pass;

                user.CUSTOMER_FULLNAME    = fullname;
                user.CUSTOMER_CONTACTNAME = fullname;
                user.CUSTOMER_BIRTHDAY    = birthday;
                user.CUSTOMER_SEX         = sex;
                user.CUSTOMER_HONNHAN     = tthonnhan;
                user.CUSTOMER_ADDRESS     = address;
                user.CUSTOMER_CITY        = cityId;
                user.CUSTOMER_PHONE1      = phone;
                user.CUSTOMER_EMAIL       = email;
                user.CUSTOMER_QUYEN       = 1;
                user.CUSTOMER_PUBLISHDATE = DateTime.Now;
                db.ESHOP_CUSTOMERs.InsertOnSubmit(user);
                user.ISACTIVE = 1;

                db.SubmitChanges();
                return(1);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return(0);
            }
        }
示例#4
0
 public bool Register(string _sFullName, string _Email, string _Pass, string _code, string _phone, string _add, int sex, string _idcity, string _iddistrict, DateTime _birth, string _codebank)
 {
     if (!Check_email(_Email))
     {
         ESHOP_CUSTOMER user = new ESHOP_CUSTOMER();
         user.CUSTOMER_EMAIL       = _Email;
         user.CUSTOMER_PW          = _Pass;
         user.CUSTOMER_FULLNAME    = _sFullName;
         user.CUSTOMER_PUBLISHDATE = DateTime.Now;
         user.CUSTOMER_PHONE1      = _phone;
         user.CUSTOMER_ADDRESS     = _add;
         user.CUSTOMER_FIELD1      = _idcity;
         user.CUSTOMER_FIELD2      = _iddistrict;
         user.CUSTOMER_FIELD3      = sex.ToString();
         user.CUSTOMER_UPDATE      = _birth;
         user.CUSTOMER_SHOWTYPE    = 0;
         user.CUSTOMER_FIELD5      = _code;
         user.CUSTOMER_TYPE        = 1;
         user.CUSTOMER_CODEBANK    = _codebank;
         db.ESHOP_CUSTOMERs.InsertOnSubmit(user);
         db.SubmitChanges();
         Load_All_Cuss(_Email);
         int _idcode = 1;
         var list    = db.ESHOP_CUSTOMERs.OrderByDescending(n => n.CUSTOMER_ID).Take(1).ToList();
         if (list.Count > 0)
         {
             _idcode = Utils.CIntDef(list[0].CUSTOMER_ID);
             string _codesale = "dl" + DateTime.Now.Day + _idcode;
             list[0].CUSTOMER_CODEID = _codesale;
             db.SubmitChanges();
         }
         return(true);
     }
     return(false);
 }
示例#5
0
 public void Load_All_Cuss(ESHOP_CUSTOMER _cus)
 {
     try
     {
         HttpContext.Current.Session["user"]          = _cus.CUSTOMER_UN_EMAIL;
         HttpContext.Current.Session["userId"]        = _cus.CUSTOMER_ID;
         HttpContext.Current.Session["user_quyen"]    = _cus.CUSTOMER_QUYEN;
         HttpContext.Current.Session["user_fullname"] = _cus.CUSTOMER_FULLNAME;
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
     }
 }
示例#6
0
        public int updateCustomerNTD(string emailuser, string fullname, int quymoId, string soluoc, string logo, string giayphep, string masothue, string address, int cityId, string website, string contactname, string contactaddress, string contactphone, string contactemail)
        {
            try
            {
                ESHOP_CUSTOMER user = GetCustomerByEmailUser(emailuser);
                if (user != null)
                {
                    user.CUSTOMER_UN_EMAIL = emailuser;

                    user.CUSTOMER_FULLNAME = fullname;
                    user.VL_QUYMOCONGTY_ID = quymoId;
                    user.CUSTOMER_SOLUOC   = soluoc;
                    if (logo != "")
                    {
                        user.CUSTOMER_LOGO = logo;
                    }
                    if (giayphep != "")
                    {
                        user.CUSTOMER_GIAYPHEP = giayphep;
                    }
                    user.CUSTOMER_MASOTHUE = masothue;
                    user.CUSTOMER_ADDRESS  = address;
                    user.CUSTOMER_CITY     = cityId;
                    user.CUSTOMER_WEBSITE  = website;

                    user.CUSTOMER_CONTACTNAME    = contactname;
                    user.CUSTOMER_CONTACTADDRESS = contactaddress;
                    user.CUSTOMER_CONTACTPHONE   = contactphone;
                    user.CUSTOMER_CONTACTEMAIL   = contactemail;

                    user.CUSTOMER_QUYEN       = 2;
                    user.CUSTOMER_PUBLISHDATE = DateTime.Now;

                    db.SubmitChanges();
                    return(1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return(0);
            }
        }
示例#7
0
 public bool Register(string salt, string _sFullName, string _Email, string _Pass, DateTime date, string addres, int gioitinh, string sodienthoai, string quan, string thanhpho)
 {
     if (!Check_email(_Email))
     {
         ESHOP_CUSTOMER user = new ESHOP_CUSTOMER();
         user.CUSTOMER_EMAIL       = _Email;
         user.CUSTOMER_PW          = _Pass;
         user.CUSTOMER_FIELD5      = salt;
         user.CUSTOMER_ADDRESS     = addres;
         user.CUSTOMER_PHONE1      = sodienthoai;
         user.CUSTOMER_FIELD3      = gioitinh.ToString();
         user.CUSTOMER_FIELD4      = "0";
         user.CUSTOMER_FULLNAME    = _sFullName;
         user.CUSTOMER_FIELD1      = thanhpho;
         user.CUSTOMER_FIELD2      = quan;
         user.CUSTOMER_PUBLISHDATE = date;
         db.ESHOP_CUSTOMERs.InsertOnSubmit(user);
         db.SubmitChanges();
         Load_All_Cuss(_Email);
         return(true);
     }
     return(false);
 }
示例#8
0
        public int Doimatkhau(string emailuser, string pass)
        {
            try
            {
                ESHOP_CUSTOMER user = GetCustomerByEmailUser(emailuser);
                if (user != null)
                {
                    user.CUSTOMER_UN_EMAIL = emailuser;

                    user.CUSTOMER_PW     = pass;
                    user.CUSTOMER_UPDATE = DateTime.Now;

                    db.SubmitChanges();
                    return(1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return(0);
            }
        }
示例#9
0
        public int updateCustomerNTV(string emailuser, string fullname, DateTime birthday, string logo, int sex, int tthonnhan, string address, int cityId, string phone, string email)
        {
            try
            {
                ESHOP_CUSTOMER user = GetCustomerByEmailUser(emailuser);
                if (user != null)
                {
                    user.CUSTOMER_UN_EMAIL = emailuser;

                    user.CUSTOMER_FULLNAME    = fullname;
                    user.CUSTOMER_CONTACTNAME = fullname;
                    user.CUSTOMER_BIRTHDAY    = birthday;
                    user.CUSTOMER_SEX         = sex;
                    if (logo != "")
                    {
                        user.CUSTOMER_LOGO = logo;
                    }
                    user.CUSTOMER_HONNHAN     = tthonnhan;
                    user.CUSTOMER_ADDRESS     = address;
                    user.CUSTOMER_CITY        = cityId;
                    user.CUSTOMER_PHONE1      = phone;
                    user.CUSTOMER_EMAIL       = email;
                    user.CUSTOMER_QUYEN       = 1;
                    user.CUSTOMER_PUBLISHDATE = DateTime.Now;

                    db.SubmitChanges();
                    return(1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return(0);
            }
        }
示例#10
0
        private void SaveInfo(string strLink = "")
        {
            try
            {
                //string _user = txtCustomerUL.Value;
                string _name = txtCustomerName.Value;
                string _email = txtCustomerEmail.Value;
                string _phone = txtCustomerPhone1.Value;
                string _address = txtaddress.Value;
                string _city = Drcity.SelectedValue;
                string _distric = Drdistric.SelectedValue;
                string _trangthai = rbl_trangthai.SelectedValue;
                string _sex = rblsex.SelectedValue;
                string _date = Dryear.SelectedValue + "/" + Drmonth.SelectedValue + "/" + Drday.SelectedIndex;
                DateTime _birth = Utils.CDateDef(_date, DateTime.Now);
                string _pass = txtpassword.Value;

                string SALT = "";
                string USER_PW = "";
                if (!string.IsNullOrEmpty(_pass))
                {
                    SALT = Common.CreateSalt();
                    USER_PW = Common.Encrypt(_pass, SALT);
                }
                var g_update = DB.GetTable<ESHOP_CUSTOMER>().Where(g => g.CUSTOMER_ID == m_customer_id);

                if (g_update.ToList().Count > 0)
                {
                    g_update.Single().CUSTOMER_FULLNAME = _name;
                    g_update.Single().CUSTOMER_EMAIL = _email;
                    g_update.Single().CUSTOMER_PHONE1 = _phone;
                    g_update.Single().CUSTOMER_ADDRESS = _address;
                    g_update.Single().CUSTOMER_FIELD1 = _city;
                    g_update.Single().CUSTOMER_FIELD2 = _distric;
                    g_update.Single().CUSTOMER_FIELD3 = _sex;
                    g_update.Single().CUSTOMER_FIELD4 = _trangthai;
                    g_update.Single().CUSTOMER_UPDATE = _birth;
                    if (!string.IsNullOrEmpty(_pass))
                    {
                        g_update.Single().CUSTOMER_FIELD5 = SALT;
                        g_update.Single().CUSTOMER_PW = USER_PW;
                    }
                    DB.SubmitChanges();

                    strLink = string.IsNullOrEmpty(strLink) ? "customer_list.aspx" : strLink;
                }
                else
                {
                    ESHOP_CUSTOMER cus = new ESHOP_CUSTOMER();
                    cus.CUSTOMER_FULLNAME = _name;
                    //cus.CUSTOMER_UN = _user;
                    cus.CUSTOMER_EMAIL = _email;
                    cus.CUSTOMER_PHONE1 = _phone;
                    cus.CUSTOMER_ADDRESS = _address;
                    cus.CUSTOMER_FIELD1 = _city;
                    cus.CUSTOMER_FIELD2 = _distric;
                    cus.CUSTOMER_FIELD3 = _sex;
                    cus.CUSTOMER_FIELD4 = _trangthai;
                    cus.CUSTOMER_UPDATE = _birth;
                    if (!string.IsNullOrEmpty(_pass))
                    {
                        cus.CUSTOMER_FIELD5 = USER_PW;
                        cus.CUSTOMER_PW = USER_PW;
                    }
                    DB.ESHOP_CUSTOMERs.InsertOnSubmit(cus);
                    DB.SubmitChanges();
                    var list = DB.ESHOP_CUSTOMERs.OrderByDescending(n => n.CUSTOMER_ID).ToList();
                    if (list.Count > 0)
                        m_customer_id = list[0].CUSTOMER_ID;
                    strLink = string.IsNullOrEmpty(strLink) ? "customer.aspx?customer_id=" + m_customer_id : strLink;
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                { Response.Redirect(strLink); }
            }
        }
示例#11
0
        private void SaveInfo(string strLink = "")
        {
            try
            {
                string   _name    = txtCustomerName.Value;
                string   _email   = txtCustomerEmail.Value;
                string   _phone   = txtCustomerPhone1.Value;
                string   _address = txtaddress.Value;
                string   _city    = Drcity.SelectedValue;
                string   _distric = Drdistric.SelectedValue;
                string   _sex     = rblsex.SelectedValue;
                string   _date    = Dryear.SelectedValue + "/" + Drmonth.SelectedValue + "/" + Drday.SelectedIndex;
                DateTime _birth   = Utils.CDateDef(_date, DateTime.Now);
                string   _pass    = txtpassword.Value;

                var g_update = DB.GetTable <ESHOP_CUSTOMER>().Where(g => g.CUSTOMER_ID == m_customer_id);

                if (g_update.ToList().Count > 0)
                {
                    g_update.Single().CUSTOMER_FULLNAME = _name;
                    g_update.Single().CUSTOMER_EMAIL    = _email;
                    g_update.Single().CUSTOMER_PHONE1   = _phone;
                    g_update.Single().CUSTOMER_ADDRESS  = _address;
                    g_update.Single().CUSTOMER_FIELD1   = _city;
                    g_update.Single().CUSTOMER_FIELD2   = _distric;
                    g_update.Single().CUSTOMER_FIELD3   = _sex;
                    g_update.Single().CUSTOMER_UPDATE   = _birth;
                    if (!String.IsNullOrEmpty(_pass))
                    {
                        g_update.Single().CUSTOMER_PW = fm.MaHoaMatKhau(_pass);
                    }
                    DB.SubmitChanges();

                    strLink = string.IsNullOrEmpty(strLink) ? "customer_list.aspx" : strLink;
                }
                else
                {
                    ESHOP_CUSTOMER cus = new ESHOP_CUSTOMER();
                    cus.CUSTOMER_FULLNAME = _name;
                    cus.CUSTOMER_EMAIL    = _email;
                    cus.CUSTOMER_PHONE1   = _phone;
                    cus.CUSTOMER_ADDRESS  = _address;
                    cus.CUSTOMER_FIELD1   = _city;
                    cus.CUSTOMER_FIELD2   = _distric;
                    cus.CUSTOMER_FIELD3   = _sex;
                    cus.CUSTOMER_UPDATE   = _birth;
                    if (!String.IsNullOrEmpty(_pass))
                    {
                        cus.CUSTOMER_PW = fm.MaHoaMatKhau(_pass);
                    }
                    DB.ESHOP_CUSTOMERs.InsertOnSubmit(cus);
                    DB.SubmitChanges();
                    var list = DB.ESHOP_CUSTOMERs.OrderByDescending(n => n.CUSTOMER_ID).ToList();
                    if (list.Count > 0)
                    {
                        m_customer_id = list[0].CUSTOMER_ID;
                    }
                    strLink = string.IsNullOrEmpty(strLink) ? "customer.aspx?customer_id=" + m_customer_id : strLink;
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
        private void SaveInfo(string strLink = "")
        {
            try
            {
                string _name = txtCustomerName.Value;
                string _email = txtCustomerEmail.Value;
                string _phone = txtCustomerPhone1.Value;
                string _codebank = txtcodebank.Value;
                string _address = txtaddress.Value;
                string _city = Drcity.SelectedValue;
                string _distric = Drdistric.SelectedValue;
                string _sex = rblsex.SelectedValue;
                string _date = Dryear.SelectedValue + "/" + Drmonth.SelectedValue + "/" + Drday.SelectedIndex;
                DateTime _birth = Utils.CDateDef(_date, DateTime.Now);
                string _pass = txtpassword.Value;

                var g_update = DB.GetTable<ESHOP_CUSTOMER>().Where(g => g.CUSTOMER_ID == m_customer_id);

                if (g_update.ToList().Count > 0)
                {

                    g_update.Single().CUSTOMER_FULLNAME = _name;
                    g_update.Single().CUSTOMER_EMAIL = _email;
                    g_update.Single().CUSTOMER_PHONE1 = _phone;
                    g_update.Single().CUSTOMER_CODEBANK = _codebank;
                    g_update.Single().CUSTOMER_ADDRESS = _address;
                    g_update.Single().CUSTOMER_FIELD1 = _city;
                    g_update.Single().CUSTOMER_FIELD2 = _distric;
                    g_update.Single().CUSTOMER_FIELD3 = _sex;
                    g_update.Single().CUSTOMER_UPDATE = _birth;
                    if (!String.IsNullOrEmpty(_pass))
                    {
                        g_update.Single().CUSTOMER_PW = fm.MaHoaMatKhau(_pass);
                    }
                    DB.SubmitChanges();

                    strLink = string.IsNullOrEmpty(strLink) ? "customer_Partner_List.aspx" : strLink;
                }
                else
                {
                    ESHOP_CUSTOMER cus = new ESHOP_CUSTOMER();
                    cus.CUSTOMER_FULLNAME = _name;
                    cus.CUSTOMER_EMAIL = _email;
                    cus.CUSTOMER_PHONE1 = _phone;
                    cus.CUSTOMER_CODEBANK = _codebank;
                    cus.CUSTOMER_ADDRESS = _address;
                    cus.CUSTOMER_FIELD1 = _city;
                    cus.CUSTOMER_FIELD2 = _distric;
                    cus.CUSTOMER_FIELD3 = _sex;
                    cus.CUSTOMER_UPDATE = _birth;
                    cus.CUSTOMER_TYPE = 1;
                    if (!String.IsNullOrEmpty(_pass))
                    {
                        cus.CUSTOMER_PW = fm.MaHoaMatKhau(_pass);
                    }
                    DB.ESHOP_CUSTOMERs.InsertOnSubmit(cus);
                    DB.SubmitChanges();
                    var list = DB.ESHOP_CUSTOMERs.OrderByDescending(n => n.CUSTOMER_ID).ToList();
                    if (list.Count > 0)
                        m_customer_id = list[0].CUSTOMER_ID;
                    strLink = string.IsNullOrEmpty(strLink) ? "customer_Partner.aspx?customer_id=" + m_customer_id : strLink;
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                { Response.Redirect(strLink); }
            }
        }