public void GetServiceItemSetting()
 {
     AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
     aspxCommonObj.StoreID = StoreID;
     aspxCommonObj.PortalID = PortalID;
     aspxCommonObj.CultureName = CultureName;
     ServiceItemController objService = new ServiceItemController();
     JavaScriptSerializer json_serializer = new JavaScriptSerializer();
     List<ServiceItemSettingInfo> lstServiceSetting = objService.GetServiceItemSetting(aspxCommonObj);
     if (lstServiceSetting != null && lstServiceSetting.Count > 0)
     {
         foreach (var serviceSetting in lstServiceSetting)
         {
             object obj = new
             {
                 IsEnableService = serviceSetting.IsEnableService,
                 ServiceCategoryInARow = serviceSetting.ServiceCategoryInARow,
                 ServiceCategoryCount = serviceSetting.ServiceCategoryCount,
                 IsEnableServiceRss = serviceSetting.IsEnableServiceRss,
                 ServiceRssCount = serviceSetting.ServiceRssCount,
                 ServiceRssPage = serviceSetting.ServiceRssPage,
                 ServiceDetailsPage = serviceSetting.ServiceDetailsPage,
                 ServiceItemDetailPage = serviceSetting.ServiceItemDetailsPage,
                 BookAnAppointmentPage = serviceSetting.BookAnAppointmentPage,
                 AppointmentSuccessPage = serviceSetting.AppointmentSuccessPage
             };
             Settings = json_serializer.Serialize(obj);
         }
     }
 }
    private void BindAllServices()
    {
        string serviceModulePath = this.AppRelativeTemplateSourceDirectory;
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath = ResolveUrl("~/");
        hst = AppLocalized.getLocale(serviceModulePath);
        string pageExtension = SageFrameSettingKeys.PageExtension;
        ServiceItemController objService = new ServiceItemController();
        List<ServiceItemSettingInfo> lstServiceSetting = objService.GetServiceItemSetting(aspxCommonObj);
        if (lstServiceSetting != null && lstServiceSetting.Count > 0)
        {
            foreach (var serviceSetting in lstServiceSetting)
            {
                isEnableService = serviceSetting.IsEnableService.ToString();
                serviceCategoryInARow = serviceSetting.ServiceCategoryInARow.ToString();
                serviceCategoryCount = serviceSetting.ServiceCategoryCount.ToString();
                isEnableServiceRss = serviceSetting.IsEnableServiceRss.ToString();
                serviceRssCount = serviceSetting.ServiceRssCount.ToString();
                serviceDetailsPage = serviceSetting.ServiceDetailsPage;
                serviceRssPage = serviceSetting.ServiceRssPage;   
            }
        }       
        List<ServiceCategoryInfo> lstAllService = objService.GetAllServices(aspxCommonObj);
        StringBuilder allServiceViewBld = new StringBuilder();

        allServiceViewBld.Append("<div id=\"divBindAllServices\" class=\"cssClassAllService\">");
        if (lstAllService != null && lstAllService.Count > 0)
        {
            foreach (var allserviceInfo in lstAllService)
            {
                string serviceName = allserviceInfo.ServiceName;
                string imagePath = "Modules/AspxCommerce/AspxCategoryManagement/uploads/" + allserviceInfo.ServiceImagePath;
                if (allserviceInfo.ServiceImagePath == "")
                {
                    imagePath = NoImageService;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(allserviceInfo.ServiceImagePath, ImageType.Medium, ImageCategoryType.Category, aspxCommonObj);
                }
                var hrefServices = aspxRedirectPath + serviceDetailsPage + "/" + AspxUtility.fixedEncodeURIComponent(serviceName) + pageExtension;
                allServiceViewBld.Append("<li><h3><a href=\"" + hrefServices + "\">");
                allServiceViewBld.Append("<div class=\"cssClassImgWrapper\">");
                allServiceViewBld.Append("<img src=\"" + aspxRootPath +
                                       imagePath.Replace("uploads", "uploads/Medium") +
                                         "\"/>");
                allServiceViewBld.Append("</div>" + serviceName + "</a></h3></li>");
            }
        }
        else
        {
            allServiceViewBld.Append("<span class=\"cssClassNotFound\">" + getLocale("There are no services available!") +
                                     "</span>");
        }
        allServiceViewBld.Append("</div>");
        ltrBindAllServices.Text = allServiceViewBld.ToString();
    }
    public List<ServiceItemSettingInfo> GetServiceItemSetting(AspxCommonInfo aspxCommonObj)
    {
        try
        {
            ServiceItemController objService = new ServiceItemController();
            List<ServiceItemSettingInfo> lstServiceItem = objService.GetServiceItemSetting(aspxCommonObj);
            return lstServiceItem;

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
 public void GetServiceSetting()
 {
     AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
     aspxCommonObj.StoreID = StoreID;
     aspxCommonObj.PortalID = PortalID;
     aspxCommonObj.CultureName = CultureName;
     ServiceItemController objService = new ServiceItemController();
     List<ServiceItemSettingInfo> lstService = objService.GetServiceItemSetting(aspxCommonObj);
     if (lstService != null && lstService.Count > 0)
     {
         foreach (ServiceItemSettingInfo item in lstService)
         {
             ServiceRssCount = item.ServiceRssCount;
         }
     }
 }
 public void BindServiceSetting()
 {
     AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
     aspxCommonObj.StoreID = StoreID;
     aspxCommonObj.PortalID = PortalID;
     aspxCommonObj.CultureName = CultureName;
     ServiceItemController objService = new ServiceItemController();
     List<ServiceItemSettingInfo> lstServiceSetting = objService.GetServiceItemSetting(aspxCommonObj);
     if (lstServiceSetting != null && lstServiceSetting.Count > 0)
     {
         foreach (var serviceSetting in lstServiceSetting)
         {                
             appointmentSuccessPage = serviceSetting.AppointmentSuccessPage;
         }
     }
 }
    private void BindServiceItemDetail(int itemID)
    {
        decimal rate = 1;
        StoreSettingConfig ssc = new StoreSettingConfig();

        decimal additionalCCVR = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName));
        string MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName);
        if (HttpContext.Current.Session["CurrencyRate"] != null)
        {
            if (Session["CurrencyCode"].ToString() != MainCurrency)
            {
                decimal rate1 = decimal.Parse(Session["CurrencyRate"].ToString());
                rate = Math.Round(rate1 + (rate1 * additionalCCVR / 100), 4);
            }
            else
            {
                rate = decimal.Parse(Session["CurrencyRate"].ToString());
            }
        }      
      
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath = ResolveUrl("~/");
        hst = AppLocalized.getLocale(serviceModulePath);
        string pageExtension = SageFrameSettingKeys.PageExtension;
        ServiceItemController objService = new ServiceItemController();
        List<ServiceItemSettingInfo> lstServiceSetting = objService.GetServiceItemSetting(aspxCommonObj);
        if (lstServiceSetting != null && lstServiceSetting.Count > 0)
        {
            foreach (var serviceSetting in lstServiceSetting)
            {
                bookAnAppointmentPage = serviceSetting.BookAnAppointmentPage;
            }
        }
        List<ServiceCategoryDetailsInfo> lstSIDetail = objService.GetServiceItemDetails(itemID, aspxCommonObj);
        StringBuilder serviceIDetailBdl = new StringBuilder();
        serviceIDetailBdl.Append("<div id=\"divServiceItemDetails\" class=\"cssServiceItemDetails\">");
        if (lstSIDetail != null && lstSIDetail.Count > 0)
        {
            foreach (ServiceCategoryDetailsInfo item in lstSIDetail)
            {
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath;
                if (item.ImagePath == "")
                {
                    imagePath = NoImageServiceItemPath;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(item.ImagePath, ImageType.Large, ImageCategoryType.Item, aspxCommonObj);
                }
                serviceIDetailBdl.Append("<div class=\"cssItemName\"><h2 class='cssClassBMar25'><span>" + item.ItemName + "</span></h2></div>");
                serviceIDetailBdl.Append("<div class=\"cssItemImage\">");
                serviceIDetailBdl.Append("<a href=\"" + aspxRootPath + imagePath + "\">");
                serviceIDetailBdl.Append("<img alt=\"" + item.ItemName + "\" src=" + aspxRootPath + imagePath.Replace("uploads", "uploads/Large") + " title=\"Click To View Large Image\"></a></div>");
                serviceIDetailBdl.Append("<div class=\"cssDesc\">");
                serviceIDetailBdl.Append("<p>" + HttpUtility.HtmlDecode(item.Description) + "</p></div>");

                serviceIDetailBdl.Append("<span class=\"cssClassServiceDuration\" value=\"" +
                                    (item.ServiceDuration) + "\">" + '(' +
                                    (item.ServiceDuration) + ' ' + "minutes" + ')' +
                                    "</span>&nbsp;");
                serviceIDetailBdl.Append("<span class=\"cssClassFormatCurrency\" value=" + (item.Price) + ">" +(item.Price * rate).ToString("N2") + "</span>");
                serviceIDetailBdl.Append("<div class=\"sfButtonwrapper\">");
                serviceIDetailBdl.Append("<a href=" + aspxRedirectPath + bookAnAppointmentPage + pageExtension + "?cid=" + item.CategoryID + "&pid=" + item.ItemID + " class='cssClassGreenBtn'>Book Now</a>");
                serviceIDetailBdl.Append("</div></div>");
            }
        }
        else
        {
            serviceIDetailBdl.Append("<div class=\"cssClassNotFound\">");
            serviceIDetailBdl.Append("<p>There is no service description available</p></div>");
        }
        serviceIDetailBdl.Append("</div>");
        ltrServiceItemDetail.Text = serviceIDetailBdl.ToString();

    }
    public void BindFrontServiceView()
    {
        string serviceModulePath = ResolveUrl(this.AppRelativeTemplateSourceDirectory);
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath = ResolveUrl("~/");
        hst = AppLocalized.getLocale(serviceModulePath);
        string pageExtension = SageFrameSettingKeys.PageExtension;
        ServiceItemController objService = new ServiceItemController();
        List<ServiceItemSettingInfo> lstServiceSetting = objService.GetServiceItemSetting(aspxCommonObj);
        if (lstServiceSetting != null && lstServiceSetting.Count > 0)
        {
            foreach (var serviceSetting in lstServiceSetting)
            {
                isEnableService = serviceSetting.IsEnableService.ToString();
                serviceCategoryInARow = serviceSetting.ServiceCategoryInARow.ToString();
                serviceCategoryCount = serviceSetting.ServiceCategoryCount.ToString();
                isEnableServiceRss = serviceSetting.IsEnableServiceRss.ToString();
                serviceRssCount = serviceSetting.ServiceRssCount.ToString();
                serviceDetailsPage = serviceSetting.ServiceDetailsPage;
                serviceRssPage = serviceSetting.ServiceRssPage;               
            }
        }
        count = int.Parse(serviceCategoryCount);             
        List<FrontServiceCategoryView> lstService = objService.GetFrontServices(aspxCommonObj, count);
        rowTotal = lstService.Count;
        if (rowTotal > count)
            lstService.RemoveAt(lstService.Count - 1);
        StringBuilder frontServiceView = new StringBuilder();
        if (lstService != null && lstService.Count > 0)
        {

            frontServiceView.Append("<div id=\"divFrontService\"><ul>");
            foreach (var serviceView in lstService)
            {
                string serviceDesc = "";
                int index = 0;
                string serviceDetails = "";
                if (serviceView.ServiceDetail != "" || serviceView.ServiceDetail != "null")
                {
                    serviceDesc = serviceView.ServiceDetail;
                    if (serviceDesc.IndexOf(' ') > 1)
                    {
                        if (serviceDesc.LastIndexOf(' ') > 60)
                        {
                            index = serviceDesc.Substring(0, 60).LastIndexOf(' ');
                            serviceDetails = serviceDesc.Substring(0, index);
                            serviceDetails = serviceDetails + "...";
                        }
                    }
                    else
                    {
                        serviceDetails = serviceDesc;
                    }
                }
                else
                {
                    serviceDetails = "";
                }
                string imagePath = "Modules/AspxCommerce/AspxCategoryManagement/uploads/" + serviceView.ServiceImagePath;
                if (serviceView.ServiceImagePath == "")
                {
                    imagePath = NoImageService;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(serviceView.ServiceImagePath, ImageType.Medium, ImageCategoryType.Category, aspxCommonObj);
                }
                var hrefServices = aspxRedirectPath + "service/" + AspxUtility.fixedEncodeURIComponent(serviceView.ServiceName) + pageExtension;
                frontServiceView.Append("<li><a href=\"");
                frontServiceView.Append(hrefServices);
                frontServiceView.Append("\"><img title=\"");
                frontServiceView.Append(serviceView.ServiceName);
                frontServiceView.Append("\" alt=\"");
                frontServiceView.Append(serviceView.ServiceName);
                frontServiceView.Append("\" src=\"");
                frontServiceView.Append(aspxRootPath);
                frontServiceView.Append(imagePath.Replace("uploads", "uploads/Medium"));
                frontServiceView.Append("\"/></a><a href=\"");
                frontServiceView.Append(hrefServices);
                frontServiceView.Append("\"><span class=\"cssClassImgWrapper\">");
                frontServiceView.Append(serviceView.ServiceName);
                frontServiceView.Append("</span></a><p>");
                frontServiceView.Append(serviceDetails);
                frontServiceView.Append("</p></li>");
            }
            frontServiceView.Append("</ul></div>");
            if (rowTotal > count)
            {
                frontServiceView.Append("<div id=\"divViewMoreServices\" class=\"cssViewMore\">");
                frontServiceView.Append("<a href=\"" + aspxRootPath + serviceDetailsPage + pageExtension + "\">" +
                                        getLocale("View More") + "</a>");
                frontServiceView.Append("</div>");
            }
        }
        else
        {
            frontServiceView.Append("<div id=\"divFrontService\"><span class=\"cssClassNotFound\">" +
                                    getLocale("There are no services available!") + "</span></div>");
        }
        ltrForntServiceView.Text = frontServiceView.ToString();
    }