Exemple #1
0
        public List <SupportListItem> TicketTypeList()
        {
            ReqEmpty request = new ReqEmpty {
            };

            return(this.Call <List <SupportListItem>, ReqEmpty>(request, "TicketTypeList"));
        }
        public MemberInfo GetMemberInfo(ReqEmpty req)
        {
            var res = Call <MemberInfo, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name);

            HttpContext.Current.Session["Member"] = res;
            return(res);
        }
Exemple #3
0
        public List <SupportStaff> GetStaff()
        {
            ReqEmpty request = new ReqEmpty {
            };

            return(this.Call <List <SupportStaff>, ReqEmpty>(request, "GetStaff"));
        }
Exemple #4
0
        public OrderInfo RemoveCouponCode(ReqEmpty req)
        {
            Order order = Order.GetMemberBasket();

            if (string.IsNullOrWhiteSpace(order.CouponItemId))
            {
                throw new APIException("No coupon used for this basket");
            }

            // kuponu serbest bırakalım
            var couponItem = Provider.Database.Read <CouponItem>("Id={0}", order.CouponItemId);

            if (couponItem != null)
            {
                var coupon = Provider.Database.Read <Coupon>("Id = {0}", couponItem.CouponId);
                if (coupon != null)
                {
                    coupon.UsedNumber--;
                    coupon.Save();
                }
            }

            order.CouponItemId = "";
            order.Discount     = 0;
            order.DiscountName = "";

            order.CalculateTotalPrice();

            order.Save();

            return(order.ToOrderInfo());
        }
 public List <IdName> GetCountryList(ReqEmpty req)
 {
     return(Provider.Database.ReadList <Country>("SELECT Id, Name FROM Country WHERE IsDeleted=0 ORDER BY Name")
            .Select(c => new IdName {
         Id = c.Id, Name = c.Name
     })
            .ToList());
 }
        public ProfileInfo GetProfileInfo(ReqEmpty req)
        {
            var res = new ProfileInfo();

            Session.Member().CopyPropertiesWithSameName(res);
            (Session.Member().MemberAddress() ?? new MemberAddress()).CopyPropertiesWithSameName(res);
            return(res);
        }
 public List <string> GetMemberNewsletters(ReqEmpty req)
 {
     return
         (Provider.Database
          .GetList <string>(
              "SELECT NewsletterDefinitionId FROM MemberNewsletter WHERE IsDeleted = 0 AND MemberId={0} AND NewsletterDefinitionId IN (SELECT Id FROM NewsletterDefinition WHERE ApiId={1})",
              Session.MemberId, ApiClient.ApiId));
 }
 public List <MemberAddressInfo> GetMemberAddressList(ReqEmpty req)
 {
     return(Provider.Database
            .ReadList <MemberAddress>(
                "SELECT * FROM MemberAddress WHERE IsDeleted=0 AND MemberId={0} ORDER BY Title",
                Session.MemberId)
            .ToEntityInfo <MemberAddressInfo>());
 }
        public bool SendConfirmationMessage(ReqEmpty req)
        {
            Provider.CurrentMember.Keyword = Utility.CreatePassword(16);
            Provider.CurrentMember.Save();

            Provider.CurrentMember.SendConfirmationCode();
            return(true);
        }
Exemple #10
0
 public List <NewsletterDefinitionInfo> GetNewsletterList(ReqEmpty req)
 {
     return
         (Provider.Database
          .ReadList <NewsletterDefinition>(
              "SELECT * FROM NewsletterDefinition WHERE ApiId={0} AND IsDeleted=0", ApiClient.ApiId)
          .ToEntityInfo <NewsletterDefinitionInfo>());
 }
        public bool Logout(ReqEmpty req)
        {
            var res = Call <bool, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name);

            this.SessionId = null;
            HttpContext.Current.Session["Member"] = null;
            HttpContext.Current.Session["Order"]  = null;
            return(res);
        }
Exemple #12
0
        public List <OrderInfo> GetOrderList(ReqEmpty req)
        {
            if (string.IsNullOrWhiteSpace(Session.MemberId))
            {
                throw new APIException("Access denied");
            }

            return(Provider.Database.ReadList <Order>("select * from [Order] where MemberId={0} AND State NOT IN ('Basket','BasketCanceled')", Session.MemberId).ToEntityInfo <OrderInfo>());
        }
Exemple #13
0
        public OrderInfo RemoveAllFromOrder(ReqEmpty req)
        {
            Order order = Order.GetMemberBasket();

            order.CouponItemId = null;
            order.Discount     = 0;
            order.RemoveAllItems();

            return(order.ToOrderInfo());
        }
Exemple #14
0
        public string GetLastMemberSSLId(ReqEmpty req)
        {
            return(Provider.Database.GetString(@"select top 1
                            ssl.Id
                        from 
                            MemberSSL ssl
                            INNER JOIN MemberProduct mp ON ssl.Id = mp.Id
                            inner join OrderItem oi ON mp.OrderItemId = oi.Id
                            inner join [Order] o ON o.Id = oi.OrderId AND o.MemberId = {0}
                        where
	                        ssl.State = 'None';"    , Session.MemberId));
        }
Exemple #15
0
        public ExchangeRates GetExchangeRates(ReqEmpty req)
        {
            ExchangeRates rates = HttpContext.Current.Application["exchangeRates"] as ExchangeRates;

            if (rates == null || rates.Date < Provider.Database.Now.Date)
            {
                rates = new ExchangeRates {
                    Date = Provider.Database.Now.Date
                };

                List <ExchangeRate> list =
                    Provider.Database.ReadList <ExchangeRate>("select * from ExchangeRate where InsertDate>={0}",
                                                              Provider.Database.Now.Date);
                if (list == null || list.Count == 0)
                {
                    XmlTextReader rdr = new XmlTextReader("http://www.tcmb.gov.tr/kurlar/today.xml");
                    DataSet       ds  = new DataSet();
                    ds.ReadXml(rdr);

                    foreach (DataRow dr in ds.Tables["Currency"].Rows)
                    {
                        try
                        {
                            ExchangeRate rate = new ExchangeRate
                            {
                                Currency =
                                    (dr["CurrencyCode"].ToString() == "USD")
                                            ? "$"
                                            : (dr["CurrencyCode"].ToString() == "EUR" ? "€" : dr["CurrencyCode"].ToString()),
                                PriceTL =
                                    Convert.ToInt32(
                                        decimal.Parse(dr["ForexSelling"].ToString(), CultureInfo.InvariantCulture) *
                                        1000000 / int.Parse(dr["Unit"].ToString()))
                            };
                            rate.Save();

                            rates.Add(rate.ToEntityInfo <ExchangeRateInfo>());
                        }
                        catch { }
                    }

                    HttpContext.Current.Application["exchangeRates"] = rates;
                }
                else
                {
                    rates.Date = Provider.Database.Now.Date;
                    rates.AddRange(list.ToEntityInfo <ExchangeRateInfo>());
                    HttpContext.Current.Application["exchangeRates"] = rates;
                }
            }

            return(rates);
        }
Exemple #16
0
        public bool TestEmailAddress(ReqEmpty req)
        {
            var    res      = Provider.Api.ApiClient;
            string email    = Provider.CurrentMember.Email;
            string fullName = Provider.CurrentMember.FullName;

            Utility.SendMail(res.MailFrom, res.Client().Name, email, fullName, "Test Mail", @"
                Dear " + fullName + ",<br/> <br/> This is a test mail sent by you.<br/> <br/> ", res.MailHost,
                             res.MailPort, res.MailUserName, res.MailPassword, res.MailFrom);

            return(true);
        }
Exemple #17
0
 /// <summary>
 /// Sitede "my products" listesini sağlayan method
 /// </summary>
 public List <ListViewMemberSSLInfo> GetMemberSSLList(ReqEmpty req)
 {
     return(Provider.Database.GetDataTable(@"
                 SELECT 
                     ssl.Id,
                     ssl.InsertDate,
                     mp.OrderItemId,
                     oi.OrderId,
                     oi.DisplayName AS ProductName,
                     ssl.State,
                     ssl.DomainName
                 FROM 
                     MemberSSL ssl
                     INNER JOIN MemberProduct mp ON ssl.Id = mp.Id
                     INNER JOIN OrderItem oi ON mp.OrderItemId = oi.Id
                     INNER JOIN [Order] o ON o.Id = oi.OrderId AND o.MemberId = {0} AND o.State = 'Order';", Session.MemberId)
            .ToEntityList <ListViewMemberSSLInfo>());
 }
Exemple #18
0
        public ResGetDashboard GetDashboard(ReqEmpty req)
        {
            var res = new ResGetDashboard()
            {
                Messages = new List <DashboardItem>()
            };

            foreach (var workerType in typeof(BaseWorker).Assembly.GetTypes())
            {
                if (workerType.IsSubclassOf(typeof(BaseWorker)))
                {
                    var worker   = (BaseWorker)Activator.CreateInstance(workerType);
                    var messages = worker.GetDashboardMessages();
                    if (messages != null && messages.Count > 0)
                    {
                        res.Messages.AddRange(messages);
                    }
                }
            }

            //TODO: bu kodun daha

            /*
             * var memberSSLIds =
             *  Provider.Database.GetList<string>(
             *      "SELECT DISTINCT Id FROM MemberSSL WHERE Id in (SELECT Id FROM MemberProduct WHERE OrderItemId IN (select Id from OrderItem where OrderId in (select Id from [Order] where MemberId = {0})))",
             *      Provider.Api.Session.MemberId);
             * res.CompletedOrders =
             *  Provider.Database.GetInt("SELECT count(*) from MemberSSL WHERE State='Completed' AND Id in ('" +
             *                           memberSSLIds.StringJoin("','") + "')");
             * res.WaitingOrders =
             *  Provider.Database.GetInt("SELECT count(*) from MemberSSL WHERE State!='Completed' AND Id in ('" +
             *                           memberSSLIds.StringJoin("','") + "')");
             */

            res.TotalOrderCost = Provider.Database.GetInt("select sum(TotalPrice) from [Order] where MemberId = {0} AND State = 'Order'",
                                                          Provider.Api.Session.MemberId);

            res.RemainingCredits    = 0; //TODO: read this from payment gateway
            res.SupportMessageCount = 0; //TODO: read this from support api

            return(res);
        }
Exemple #19
0
        public OrderInfo GetMemberBasket(ReqEmpty req)
        {
            Order order = Order.GetMemberBasket();

            var res = order.ToOrderInfo();

            if (string.IsNullOrWhiteSpace(order.MemberAddressId) && Provider.CurrentMember != null)
            {
                order.MemberAddressId = Provider.CurrentMember.MemberAddressId;
                if (!string.IsNullOrWhiteSpace(order.MemberAddressId))
                {
                    order.Save();
                }
            }

            if (!string.IsNullOrWhiteSpace(order.MemberAddressId))
            {
                res.Address = Provider.Database.Read <MemberAddress>("Id={0}", order.MemberAddressId).ToEntityInfo <MemberAddressInfo>();
            }

            return(res);
        }
Exemple #20
0
 public List<ListViewMemberDomainInfo> GetMemberDomainList(ReqEmpty req)
 {
     return Provider.Database.GetDataTable(@"
                 SELECT 
                     dom.Id,
                     dom.InsertDate,
                     mp.OrderItemId,
                     oi.OrderId,
                     mp.MemberId,
                     m.FirstName + ' ' + m.LastName as MemberName,
                     oi.DisplayName AS ProductName,
                     dom.RenewalMode,
                     mp.StartDate,
                     mp.EndDate,
                     dom.DomainName
                 FROM 
                     MemberDomain dom
                     INNER JOIN MemberProduct mp ON dom.Id = mp.Id
                     INNER JOIN Member m ON o.MemberId = m.Id
                     INNER JOIN OrderItem oi ON mp.OrderItemId = oi.Id
                     INNER JOIN [Order] o ON o.Id = oi.OrderId AND o.MemberId = {0} AND o.State = 'Order';", Session.MemberId)
            .ToEntityList<ListViewMemberDomainInfo>();
 }
Exemple #21
0
        public List <CrmActivityInfo> GetCrmActivities(ReqEmpty req)
        {
            if (string.IsNullOrWhiteSpace(Provider.CurrentMember.Id))
            {
                throw new APIException("Access is denied");
            }

            var entities =
                Provider.Database.ReadList <CrmActivity>(
                    @"
                        SELECT 
                            ca.*,
                            j.State
                        FROM 
                            CrmActivity ca, Job j
                        WHERE 
                            j.RelatedEntityId = ca.Id AND
                            j.RelatedEntityName = 'CrmActivity' AND
                            ca.MemberId = {0} AND 
                            ca.IsDeleted = 0
                        ORDER BY
                            ca.InsertDate desc", Provider.CurrentMember.Id);

            var dtos = new List <CrmActivityInfo>();

            foreach (var e in entities)
            {
                var dto = new CrmActivityInfo();
                e.CopyPropertiesWithSameName(dto);
                dto.State      = (JobStates)Enum.Parse(typeof(JobStates), (string)e["State"]);
                dto.ReplyCount = Provider.Database.GetInt("select count(*) from CrmActivityMessage where CrmActivityId = {0}", e.Id);

                dtos.Add(dto);
            }

            return(dtos);
        }
Exemple #22
0
        public List <MdfResellerInfo> GetMdfList(ReqEmpty req)
        {
            return(Provider.Database.GetDataTable(@"
                    select
	                    m.Id as MdfId,
	                    m.Name,
	                    m.StartDate,
	                    m.EndDate,
	                    m.RebateRate,
	                    m.RebateAmount,
	                    m.LimitBottom,
	                    mr.Id,
	                    mr.State,
	                    mr.CreditsToRefund
                    from 
	                    Mdf m
	                    LEFT JOIN MdfReseller mr ON mr.MdfId = m.Id AND mr.ResellerId = {0}
                    where
	                    m.ResellerTypeId = {1} AND
	                    m.AnnounceStartDate<=getdate() AND
	                    m.AnnounceEndDate>=getdate();
                    ", Provider.CurrentMember.Id, Provider.CurrentMember.Reseller().ResellerTypeId)
                   .ToEntityList <MdfResellerInfo>());
        }
 public List <NewsletterDefinitionInfo> GetNewsletterList(ReqEmpty req)
 {
     return(Call <List <NewsletterDefinitionInfo>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <ListDMPredefinedMessageInfo> GetDMPredefinedMessages(ReqEmpty req)
 {
     return(Call <List <ListDMPredefinedMessageInfo>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <IdName> GetMyItemsIdNotOnSale(ReqEmpty req)
 {
     return(Call <List <IdName>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <IdName> GetDomainBlackList(ReqEmpty req)
 {
     return(Call <List <IdName>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <string> GetItemTypesList(ReqEmpty req)
 {
     return(Call <List <string>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <IdName> GetLanguageList(ReqEmpty req)
 {
     return(Call <List <IdName>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <IdName> GetItemCategoryList(ReqEmpty req)
 {
     return(Call <List <IdName>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }
 public List <string> GetDMItemExtensions(ReqEmpty req)
 {
     return(Call <List <string>, ReqEmpty>(req, MethodBase.GetCurrentMethod().Name));
 }