Example #1
0
        public string CustomerImport(int store_id, int LoggedInUserId, int customer_group_id, DataTable CustomerTable, string UserPassword)
        {
            string CustomerXml = GeneralMethods.ConvertDatatableToXML(CustomerTable);

            try
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("store_id", store_id);
                param[1] = new SqlParameter("LoggedInUserId", LoggedInUserId);
                param[2] = new SqlParameter("customer_group_id", customer_group_id);
                param[3] = new SqlParameter("CustomerXml", CustomerXml);

                //var result = CustomerEntityGenericRepository.ExecuteSQL<string>("EXEC ImportCustomerXml", param).FirstOrDefault();
                var listPasswordOfCustomer = CustomerEntityGenericRepository.ExecuteSQL <ImportCustomerEmailEntity>("EXEC ImportCustomerXml", param).ToList();
                //if (listPasswordOfCustomer != null && listPasswordOfCustomer.Count > 0)
                if (string.IsNullOrWhiteSpace(listPasswordOfCustomer.FirstOrDefault().ErrorLog))
                {
                    SendCustomerImportMailToCustomer(listPasswordOfCustomer, store_id, UserPassword);
                }
                var result = string.IsNullOrWhiteSpace(listPasswordOfCustomer.FirstOrDefault().ErrorLog) ? string.Empty : listPasswordOfCustomer.FirstOrDefault().ErrorLog;
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public List <PointsAuditEntity> PointsImporter(int store_id, int LoggedInUserId, bool IsSendEmail, DataTable PointsTable)
        {
            string PointsXml = GeneralMethods.ConvertDatatableToXML(PointsTable);

            try
            {
                SqlParameter[] param = new SqlParameter[3];
                param[0] = new SqlParameter("store_id", store_id);
                param[1] = new SqlParameter("IsSendEmail", IsSendEmail);
                param[2] = new SqlParameter("PointsXml", PointsXml);

                List <PointsAuditEntity> result = CustomerEntityGenericRepository.ExecuteSQL <PointsAuditEntity>("EXEC ImportPointsXml", param).ToList();
                //if (IsSendEmail && string.IsNullOrWhiteSpace(result.FirstOrDefault().invalidEmail))
                if (IsSendEmail)
                {
                    SendPointImportMailToCustomer(PointsXml, store_id);
                }
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }