Exemplo n.º 1
0
 public Address(int addid)
 {
     tbl_AddressCustomer add = new tbl_AddressCustomer(addid);
     this.Address1 = add.addAddress1;
     this.Address2 = add.addAddress2;
     this.City = add.addCity;
     this.State = add.addRegion;
     this.StateCode = add.addRegion;
     this.PostalCode = add.addPostalCode;
     this.Country = add.addCountry;
 }
Exemplo n.º 2
0
 private void GetData(tbl_AddressCustomer address)
 {
     address.addID = this.addID;
     address.addAddress1 = this.addAddress1;
     address.addAddress2 = this.addAddress2;
     address.addAddress3 = this.addAddress3;
     address.addCity = this.addCity;
     address.addRegion = this.addRegion;
     address.addCountry = this.addCountry;
     address.addPostalCode = this.addPostalCode;
     address.addSource = this.addSource;
     address.addTempID = this.addTempID;
     address.addDateCreated = this.addDateCreated;
     address.addDateUpdated = this.addDateUpdated;
 }
Exemplo n.º 3
0
 private void GetData(tbl_AddressCustomer address)
 {
     address.addID          = this.addID;
     address.addAddress1    = this.addAddress1;
     address.addAddress2    = this.addAddress2;
     address.addAddress3    = this.addAddress3;
     address.addCity        = this.addCity;
     address.addRegion      = this.addRegion;
     address.addCountry     = this.addCountry;
     address.addPostalCode  = this.addPostalCode;
     address.addSource      = this.addSource;
     address.addTempID      = this.addTempID;
     address.addDateCreated = this.addDateCreated;
     address.addDateUpdated = this.addDateUpdated;
 }
Exemplo n.º 4
0
 private void SetData(tbl_AddressCustomer address)
 {
     this.addID = address.addID;
     this.addAddress1 = address.addAddress1;
     this.addAddress2 = address.addAddress2;
     this.addAddress3 = address.addAddress3;
     this.addCity = address.addCity;
     this.addRegion = address.addRegion;
     this.addCountry = address.addCountry;
     this.addPostalCode = address.addPostalCode;
     this.addSource = address.addSource;
     this.addTempID = address.addTempID;
     this.addDateCreated = address.addDateCreated;
     this.addDateUpdated = address.addDateUpdated;
 }
Exemplo n.º 5
0
 private void SetData(tbl_AddressCustomer address)
 {
     this.addID          = address.addID;
     this.addAddress1    = address.addAddress1;
     this.addAddress2    = address.addAddress2;
     this.addAddress3    = address.addAddress3;
     this.addCity        = address.addCity;
     this.addRegion      = address.addRegion;
     this.addCountry     = address.addCountry;
     this.addPostalCode  = address.addPostalCode;
     this.addSource      = address.addSource;
     this.addTempID      = address.addTempID;
     this.addDateCreated = address.addDateCreated;
     this.addDateUpdated = address.addDateUpdated;
 }
Exemplo n.º 6
0
 public void Save()
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         if (this.addID > 0)
         {
             tbl_AddressCustomer address = (from a in context.tbl_AddressCustomers
                                            where a.addID == this.addID
                                            select a).SingleOrDefault();
             GetData(address);
             context.SubmitChanges();
         }
         else
         {
             context.tbl_AddressCustomers.InsertOnSubmit(this);
             context.SubmitChanges();
         }
     }
 }
Exemplo n.º 7
0
        public static object[] Login(string enc_username, string enc_password)
        {
            tbl_Customer         customer = new tbl_Customer();
            tbl_AddressCustomer  address  = new tbl_AddressCustomer();
            tbl_NetMembership    current_netmembership = new tbl_NetMembership();
            CustomerResponseCode response_code         = Authenticate(enc_username, enc_password);

            if (response_code == CustomerResponseCode.SUCCESS)
            {
                customer = new tbl_Customer(enc_username, true, true);
                address  = new tbl_AddressCustomer(customer.addID);
                current_netmembership = tbl_NetMembership.GetCurrentNetMembership(customer.cusID);
                if (current_netmembership == null)
                {
                    response_code = CustomerResponseCode.NO_SUB;
                }
            }
            return(new object[] { response_code, customer, address, current_netmembership });
        }
Exemplo n.º 8
0
        public static object[] CreateCustomer(string address1, string address2, string address3, 
            string city, string region, string country, string postal, string source, 
            string password, string customertype, string salutation, string firstname, 
            string middleinitial, string lastname, string suffix, string emailaddress, 
            string username, string newmemberid, string pubcode, string expiredate, 
            string startdate, string screenname, string mobilephone, string secondemail, string keycode)
        {
            CustomerResponseCode responsecode = 0;
            tbl_Customer Customer = new tbl_Customer();
            tbl_NetMembership NetMembership = new tbl_NetMembership();
            tbl_AddressCustomer Address = new tbl_AddressCustomer();

            #region convert string input to correct types
            DateTime dt_expiredate = new DateTime();
            DateTime dt_startdate = new DateTime();

            if (!DateTime.TryParse(expiredate, out dt_expiredate))
            {
                responsecode = CustomerResponseCode.CANNOT_CONVERT_EXPIREDATE;
            }
            if (!DateTime.TryParse(startdate, out dt_startdate))
            {
                responsecode = CustomerResponseCode.CANNOT_CONVERT_STARTDATE;
            }             
            #endregion

            if (responsecode == 0)
            {
                #region check user name availability
                switch (tbl_Customer.CheckUserName(username))
                {
                    case 0:
                        responsecode = 0;
                        break;
                    case 1:
                        responsecode = CustomerResponseCode.DUPLICATE_USER_NAME;
                        break;
                    case 2:
                        responsecode = CustomerResponseCode.DUPLICATE_EMAIL_ADDRESS;
                        break;
                    case 3:
                        responsecode = CustomerResponseCode.DUPLICATE_USER_NAME;
                        break;
                }
                #endregion
                if (responsecode == 0)
                {
                    using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
                    {
                        #region get cuscustnum
                        long newcustnum = 0;
                        try
                        {
                            long lastcustomer = (from a in context.tbl_Customers select a.cusCustNum).Select(x => Convert.ToInt64(x)).Max();
                            newcustnum = lastcustomer + 1;
                        }
                        catch
                        {
                            responsecode = CustomerResponseCode.CANNOT_CREATE_CUSCUSTNUM;
                        }
                        #endregion

                        if (responsecode == 0)
                        {
                            #region address data at AH
                            Address = new tbl_AddressCustomer();
                            Address.addAddress1 = address1;
                            Address.addAddress2 = address2;
                            Address.addAddress3 = address3;
                            Address.addCity = city;
                            Address.addCountry = country;
                            Address.addDateCreated = DateTime.Now;
                            Address.addDateUpdated = DateTime.Now;
                            Address.addPostalCode = postal;
                            Address.addRegion = string.IsNullOrEmpty(region) ? "" : region;
                            Address.addSource = string.Empty;
                            context.tbl_AddressCustomers.InsertOnSubmit(Address);
                            context.SubmitChanges();
                            #endregion

                            #region customer data at AH
                            Customer.cusEncryptedPassword = HarperCRYPTO.Cryptography.EncryptData(password);
                            Customer.cusPassword = HarperCRYPTO.Cryptography.Encrypt256(password);
                            Customer.cusPasswordSalt = HarperCRYPTO.Cryptography.Salt;
                            Customer.addID = Address.addID;
                            Customer.cusCustNum = newcustnum.ToString();
                            Customer.cusCustType = customertype;
                            Customer.cusFirstName = firstname;
                            Customer.cusLastName = lastname;
                            Customer.cusPriFirstName = firstname;
                            Customer.cusPriLastName = lastname;
                            Customer.cusEmail = emailaddress;
                            Customer.cusUserName = username;
                            Customer.cusIsCharterMem = false;
                            Customer.cusDateCreated = DateTime.Now;
                            Customer.cusDateUpdated = DateTime.Now;
                            Customer.cusIsDeleted = false;
                            Customer.cusSex = 'U';
                            Customer.cusGUID = Guid.NewGuid();
                            Customer.cusDisplayName = screenname;
                            Customer.cusMobile = mobilephone;
                            Customer.cusHasDisplayName = true;
                            Customer.cusSecondEmail = secondemail;
                            Customer.cusMemberSince = DateTime.Now;
                            Customer.cusSource = source;
                            Customer.cusKeyCode = keycode;
                            Customer.csoCode = source;
                            long.TryParse(newmemberid, out Customer.SfgId);
                            context.tbl_Customers.InsertOnSubmit(Customer);
                            context.SubmitChanges();
                            #endregion

                            #region sfg customer number data at AH
                            HarperLINQ.SFG_CustomerNumber SfgData = new HarperLINQ.SFG_CustomerNumber();
                            SfgData.cusID = Customer.cusID;
                            SfgData.SFGCustNum = newmemberid;
                            context.SFG_CustomerNumbers.InsertOnSubmit(SfgData);
                            context.SubmitChanges();
                            #endregion

                            #region net membership data at AH
                            NetMembership = new tbl_NetMembership();
                            NetMembership.cusID = Customer.cusID;
                            NetMembership.mtyCode = HarperLINQ.SFG_ProdCode.GetFromExtCode(pubcode).IntCode;
                            NetMembership.nmbDateCreated = DateTime.Now;
                            NetMembership.nmbDateEnd = dt_expiredate;
                            NetMembership.nmbDateStart = dt_startdate;
                            context.tbl_NetMemberships.InsertOnSubmit(NetMembership);
                            context.SubmitChanges();
                            #endregion

                        }
                    }
                }
            }
            return new object[] { responsecode, Customer, Address, NetMembership };
        }
Exemplo n.º 9
0
 public static object[] Login(string enc_username, string enc_password)
 {
     tbl_Customer customer = new tbl_Customer();
     tbl_AddressCustomer address = new tbl_AddressCustomer();
     tbl_NetMembership current_netmembership = new tbl_NetMembership();            
     CustomerResponseCode response_code = Authenticate(enc_username, enc_password);
     if (response_code == CustomerResponseCode.SUCCESS)
     {
         customer = new tbl_Customer(enc_username, true, true);
         address = new tbl_AddressCustomer(customer.addID);
         current_netmembership = tbl_NetMembership.GetCurrentNetMembership(customer.cusID);
         if (current_netmembership == null)
         {
             response_code = CustomerResponseCode.NO_SUB;
         }
     }
     return new object[] { response_code, customer, address, current_netmembership };
 }
Exemplo n.º 10
0
 partial void Deletetbl_AddressCustomer(tbl_AddressCustomer instance);
Exemplo n.º 11
0
 partial void Updatetbl_AddressCustomer(tbl_AddressCustomer instance);
Exemplo n.º 12
0
 partial void Inserttbl_AddressCustomer(tbl_AddressCustomer instance);
Exemplo n.º 13
0
        public static object[] CreateCustomer(string address1, string address2, string address3,
                                              string city, string region, string country, string postal, string source,
                                              string password, string customertype, string salutation, string firstname,
                                              string middleinitial, string lastname, string suffix, string emailaddress,
                                              string username, string newmemberid, string pubcode, string expiredate,
                                              string startdate, string screenname, string mobilephone, string secondemail, string keycode)
        {
            CustomerResponseCode responsecode  = 0;
            tbl_Customer         Customer      = new tbl_Customer();
            tbl_NetMembership    NetMembership = new tbl_NetMembership();
            tbl_AddressCustomer  Address       = new tbl_AddressCustomer();

            #region convert string input to correct types
            DateTime dt_expiredate = new DateTime();
            DateTime dt_startdate  = new DateTime();

            if (!DateTime.TryParse(expiredate, out dt_expiredate))
            {
                responsecode = CustomerResponseCode.CANNOT_CONVERT_EXPIREDATE;
            }
            if (!DateTime.TryParse(startdate, out dt_startdate))
            {
                responsecode = CustomerResponseCode.CANNOT_CONVERT_STARTDATE;
            }
            #endregion

            if (responsecode == 0)
            {
                #region check user name availability
                switch (tbl_Customer.CheckUserName(username))
                {
                case 0:
                    responsecode = 0;
                    break;

                case 1:
                    responsecode = CustomerResponseCode.DUPLICATE_USER_NAME;
                    break;

                case 2:
                    responsecode = CustomerResponseCode.DUPLICATE_EMAIL_ADDRESS;
                    break;

                case 3:
                    responsecode = CustomerResponseCode.DUPLICATE_USER_NAME;
                    break;
                }
                #endregion
                if (responsecode == 0)
                {
                    using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
                    {
                        #region get cuscustnum
                        long newcustnum = 0;
                        try
                        {
                            long lastcustomer = (from a in context.tbl_Customers select a.cusCustNum).Select(x => Convert.ToInt64(x)).Max();
                            newcustnum = lastcustomer + 1;
                        }
                        catch
                        {
                            responsecode = CustomerResponseCode.CANNOT_CREATE_CUSCUSTNUM;
                        }
                        #endregion

                        if (responsecode == 0)
                        {
                            #region address data at AH
                            Address                = new tbl_AddressCustomer();
                            Address.addAddress1    = address1;
                            Address.addAddress2    = address2;
                            Address.addAddress3    = address3;
                            Address.addCity        = city;
                            Address.addCountry     = country;
                            Address.addDateCreated = DateTime.Now;
                            Address.addDateUpdated = DateTime.Now;
                            Address.addPostalCode  = postal;
                            Address.addRegion      = string.IsNullOrEmpty(region) ? "" : region;
                            Address.addSource      = string.Empty;
                            context.tbl_AddressCustomers.InsertOnSubmit(Address);
                            context.SubmitChanges();
                            #endregion

                            #region customer data at AH
                            Customer.cusEncryptedPassword = HarperCRYPTO.Cryptography.EncryptData(password);
                            Customer.cusPassword          = HarperCRYPTO.Cryptography.Encrypt256(password);
                            Customer.cusPasswordSalt      = HarperCRYPTO.Cryptography.Salt;
                            Customer.addID             = Address.addID;
                            Customer.cusCustNum        = newcustnum.ToString();
                            Customer.cusCustType       = customertype;
                            Customer.cusFirstName      = firstname;
                            Customer.cusLastName       = lastname;
                            Customer.cusPriFirstName   = firstname;
                            Customer.cusPriLastName    = lastname;
                            Customer.cusEmail          = emailaddress;
                            Customer.cusUserName       = username;
                            Customer.cusIsCharterMem   = false;
                            Customer.cusDateCreated    = DateTime.Now;
                            Customer.cusDateUpdated    = DateTime.Now;
                            Customer.cusIsDeleted      = false;
                            Customer.cusSex            = 'U';
                            Customer.cusGUID           = Guid.NewGuid();
                            Customer.cusDisplayName    = screenname;
                            Customer.cusMobile         = mobilephone;
                            Customer.cusHasDisplayName = true;
                            Customer.cusSecondEmail    = secondemail;
                            Customer.cusMemberSince    = DateTime.Now;
                            Customer.cusSource         = source;
                            Customer.cusKeyCode        = keycode;
                            Customer.csoCode           = source;
                            long.TryParse(newmemberid, out Customer.SfgId);
                            context.tbl_Customers.InsertOnSubmit(Customer);
                            context.SubmitChanges();
                            #endregion

                            #region sfg customer number data at AH
                            HarperLINQ.SFG_CustomerNumber SfgData = new HarperLINQ.SFG_CustomerNumber();
                            SfgData.cusID      = Customer.cusID;
                            SfgData.SFGCustNum = newmemberid;
                            context.SFG_CustomerNumbers.InsertOnSubmit(SfgData);
                            context.SubmitChanges();
                            #endregion

                            #region net membership data at AH
                            NetMembership                = new tbl_NetMembership();
                            NetMembership.cusID          = Customer.cusID;
                            NetMembership.mtyCode        = HarperLINQ.SFG_ProdCode.GetFromExtCode(pubcode).IntCode;
                            NetMembership.nmbDateCreated = DateTime.Now;
                            NetMembership.nmbDateEnd     = dt_expiredate;
                            NetMembership.nmbDateStart   = dt_startdate;
                            context.tbl_NetMemberships.InsertOnSubmit(NetMembership);
                            context.SubmitChanges();
                            #endregion
                        }
                    }
                }
            }
            return(new object[] { responsecode, Customer, Address, NetMembership });
        }