public CompanyProfileDto GetCompanyProfile() { using (EAharaDB context = new EAharaDB()) { var dataItem = context.CompanyProfiles.FirstOrDefault(x => x.Id > 0); if (dataItem != null) { if (dataItem != null) { CompanyProfileDto returndata = new CompanyProfileDto(); returndata.Id = dataItem.Id; returndata.Name = dataItem.Name; returndata.WhatsappNo = dataItem.WhatsappNo; returndata.TeleNo = dataItem.TeleNo; returndata.Address = dataItem.Address; returndata.Email = dataItem.Email; returndata.MobileNo = dataItem.MobileNo; returndata.Location = dataItem.Location; returndata.RegPoints = dataItem.RegPoints; returndata.BookingPoints = dataItem.BookingPoints; returndata.Points = dataItem.Points; returndata.WalletLimit = dataItem.WalletLimit; returndata.ShareText = dataItem.ShareText; returndata.SMSID = dataItem.SMSID; returndata.SMSpassword = dataItem.SMSpassword; returndata.SMSusername = dataItem.SMSusername; return(returndata); } } return(null); } }
public List <ReviewDto> ReviewsInDashboard(int id) { using (EAharaDB context = new EAharaDB()) { var dataList = context.Reviews.Where(x => x.IsActive) .Select(x => new ReviewDto { Id = x.Id, Description = x.Description, Rating = x.Rating, IsActive = x.IsActive, Name = x.Name, MobileNo = x.MobileNo, EmailId = x.EmailId, ShopId = x.ShopId, Shop = new ShopDto { Id = x.Shop.Id, Name = x.Shop.Name, }, }).OrderByDescending(x => x.Id).Skip(id).Take(3).ToList(); return(dataList); } }
public List <ShopMenuDto> GetShopMenu(long id) { if (id > 0) { using (EAharaDB context = new EAharaDB()) { var data = context.ShopMenus.Where(x => x.IsActive && x.ShopId == id) .Select(x => new ShopMenuDto { Id = x.Id, Tittle = x.Tittle, Image = x.Image, IsActive = x.IsActive, ShopId = x.ShopId, Shop = new ShopDto { Id = x.Shop.Id, Name = x.Shop.Name, }, }).OrderByDescending(x => x.Id).ToList(); return(data); } } return(null); }
public DataSourceResult TagInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.Tags.Where(x => x.IsActive == true) .Select(x => new TagDto { Id = x.Id, ShopId = x.ShopId, Description = x.Description, ItemId = x.ItemId, IsActive = x.IsActive, Shop = new ShopDto { Id = x.Shop != null ? x.Shop.Id : 0, Name = x.Shop != null ? x.Shop.Name : " ", }, Item = new ItemDto { Id = x.Item != null ? x.Item.Id : 0, Name = x.Item != null ? x.Item.Name : " ", }, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public List <ShopInfoDto> GetShopInfo(long id) { if (id > 0) { using (EAharaDB context = new EAharaDB()) { var data = context.ShopInfos.Where(x => x.IsActive && x.ShopId == id) .Select(x => new ShopInfoDto { Id = x.Id, Description = x.Description, IsActive = x.IsActive, ShopId = x.ShopId, Shop = new ShopDto { Id = x.Shop.Id, Name = x.Shop.Name, }, }).OrderByDescending(x => x.Id).ToList(); return(data); } } return(null); }
public bool sendSMS(string message, string mobno) { string msg = message; var temp = mobno; temp = mobno.ToString(); if (temp.Length == 10) { temp = string.Concat("+91" + temp); } using (EAharaDB context = new EAharaDB()) { var cp = context.CompanyProfiles.FirstOrDefault(); string myParameters = "User="******"&passwd= " + cp.SMSpassword + "&mobilenumber=" + temp + "&message=" + msg + "&sid=" + cp.SMSID + "&mtype=N&DR=Y"; string URI = "http://api.smscountry.com/SMSCwebservice_bulk.aspx?"; using (WebClient sms = new WebClient()) { sms.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; string HtmlResult = sms.UploadString(URI, myParameters); } return(true); } }
public DataSourceResult MEDSubCategoriesInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.MEDSubCategories.Where(x => x.IsActive == true) .Select(x => new MEDSubCategoryDto { Id = x.Id, Name = x.Name, MEDCategoryId = x.MEDCategoryId, MEDCategory = new MEDCategoryDto() { Id = x.MEDCategory.Id, Name = x.MEDCategory.Name, }, IsActive = x.IsActive, Image = x.Image, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public bool ReorderUpload(long id) { using (EAharaDB context = new EAharaDB()) { if (id != 0) { var Delete = context.MEDUploads.FirstOrDefault(x => x.Id == id); if (Delete != null) { MEDUpload item = new MEDUpload(); item.Name = Delete.Name; item.EmailId = Delete.EmailId; item.MobileNo = Delete.MobileNo; item.OrderDate = Delete.OrderDate; item.CustomerId = Delete.CustomerId; item.Path = Delete.Path; item.Date = DateTime.Now; item.IsActive = true; context.MEDUploads.Add(item); context.SaveChanges(); return(true); } return(false); } } return(false); }
public DataSourceResult MEDUploadsInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.MEDUploads.Where(x => x.IsActive == true) .Select(x => new MEDUploadDto { Id = x.Id, Name = x.Name, IsActive = x.IsActive, MobileNo = x.MobileNo, EmailId = x.EmailId, Path = x.Path, Remarks = x.Remarks, OrderDate = x.OrderDate, Date = x.Date, MEDBookingId = x.MEDBookingId, MEDBooking = new MEDBookingDto { RefNo = x.MEDBooking != null ? x.MEDBooking.RefNo : "", } }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public static UserSession LoginWithUserName(string userName, string password) { UserSession userSession = null; using (EAharaDB context = new EAharaDB()) { var user = context.Users.FirstOrDefault(x => x.UserName == userName && x.IsActive); if (user != null) { var storedPassword = Convert.FromBase64String(user.Password); var a = ComparePasswords(storedPassword, Encoding.ASCII.GetBytes(password)); if (ComparePasswords(storedPassword, Encoding.ASCII.GetBytes(password))) { string token = Convert.ToBase64String(Guid.NewGuid().ToByteArray()); userSession = new UserSession(); userSession.ExpiresInMinutes = 480; userSession.SessionTimeStamp = DateTime.Now; userSession.Token = token; userSession.UserId = user.Id; context.UserSessions.Add(userSession); context.SaveChanges(); userSession.User = context.Users .FirstOrDefault(x => x.Id == userSession.UserId); return(userSession); } else { throw new WebFaultException(HttpStatusCode.Forbidden); } } return(null); } }
public int SendRegisterOtp(string MobileNo) { using (EAharaDB context = new EAharaDB()) { if (MobileNo != "" && MobileNo != null) { var old = context.Customers.FirstOrDefault(x => x.IsActive && x.MobileNo == MobileNo); if (old != null) { return(2); } AuthenticationBL authBl = new AuthenticationBL(); int Otp = authBl.GenerateUserOtp(MobileNo); if (Otp > 0) { MessageController messagectrl = new MessageController(); string msg = Otp + " is your Eahara verification code no, which expires in few minutes."; messagectrl.sendOTPSMS(msg, MobileNo); return(Otp); } } } return(0); }
public int GenerateUserOtp(string MobileNo) { using (EAharaDB context = new EAharaDB()) { var userOtp = context.UserOTPs.FirstOrDefault(x => x.MobileNo == MobileNo); if (userOtp != null) { Random rnd = new Random(); int otp = rnd.Next(1000, 9999); userOtp.OTP = otp; userOtp.Date = DateTime.Now; context.Entry(userOtp).State = EntityState.Modified; context.SaveChanges(); return(otp); } else { userOtp = new UserOTP(); Random rnd = new Random(); int otp = rnd.Next(1000, 9999); userOtp.MobileNo = MobileNo; userOtp.OTP = otp; userOtp.Date = DateTime.Now; context.UserOTPs.Add(userOtp); context.SaveChanges(); return(otp); } } }
public DataSourceResult ShopsInMultiSelect(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { BasicAuthenticationIdentity identity = (BasicAuthenticationIdentity)User.Identity; var user = context.Users.FirstOrDefault(x => x.Id == identity.Id); var shops = context.Shops.Where(x => x.IsActive); if (user.Role == "Employee") { if (user.Employee != null) { shops = shops.Where(x => x.LocationId == user.Employee.LocationId); } } var dataSourceResult = shops .Select(x => new ShopDto { Id = x.Id, IsActive = x.IsActive, Name = x.Name, MobileNo = x.MobileNo, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public List <ShopDto> ShopsInNoUserDropdown() { List <ShopDto> DtoList; using (EAharaDB context = new EAharaDB()) { BasicAuthenticationIdentity identity = (BasicAuthenticationIdentity)User.Identity; var user = context.Users.FirstOrDefault(x => x.Id == identity.Id); var query = context.Shops.Where(x => x.IsActive == true && context.Users.Where(y => y.IsActive == true && y.ShopId == x.Id).Count() == 0); if (user.Role == "Employee") { if (user.Employee != null) { query = query.Where(x => x.LocationId == user.Employee.LocationId); } } var data = query .Select(x => new ShopDto { Id = x.Id, IsActive = x.IsActive, Name = x.Name, }).ToList(); DtoList = data; } return(DtoList); }
public List <ItemImageDto> GetItemImage(long id) { if (id > 0) { using (EAharaDB context = new EAharaDB()) { var data = context.ItemImages.Where(x => x.IsActive && x.ItemId == id) .Select(x => new ItemImageDto { Id = x.Id, ItemId = x.ItemId, Name = x.Name, Image = x.Image, Item = new ItemDto { Name = x.Item.Name, Id = x.Item.Id, } }).OrderByDescending(x => x.Id).ToList(); return(data); } } return(null); }
public List <MEDUploadDto> MyMEDUploadsInApp(long id) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.MEDUploads.Where(x => x.IsActive == true && x.CustomerId == id) .Select(x => new MEDUploadDto { Id = x.Id, Name = x.Name, IsActive = x.IsActive, MobileNo = x.MobileNo, EmailId = x.EmailId, Path = x.Path, Remarks = x.Remarks, OrderDate = x.OrderDate, Date = x.Date, MEDBookingId = x.MEDBookingId, MEDBooking = new MEDBookingDto { RefNo = x.MEDBooking != null ? x.MEDBooking.RefNo : "", } }).OrderByDescending(x => x.Id).ToList(); return(dataSourceResult); } }
public bool sendOTPSMS(string message, string mobno) { string msg = message; var temp = mobno; temp = mobno.ToString(); if (temp.Length == 10) { temp = string.Concat("+91" + temp); } using (EAharaDB context = new EAharaDB()) { var cp = context.CompanyProfiles.FirstOrDefault(); string myParameters = "user="******"eahara" + "&passwd= " + "bindas1234" + "&mobilenumber=" + temp + "&message=" + msg + "&sid=" + cp.SMSID + "&mtype=N&DR=Y"; string URI = "http://api.smscountry.com/SMSCwebservice_bulk.aspx?"; //string myParameters = "user="******"sultan" + "&password= "******"5HT4R37G" + "&msisdn=" + temp + "&sid=" + "eAHARA" + "&msg=" + msg + "&fl=0&gwid=2"; //string URI = "http://sms.planetweb.co.in/vendorsms/pushsms.aspx?"; using (WebClient sms = new WebClient()) { sms.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; string HtmlResult = sms.UploadString(URI, myParameters); } return(true); } }
public LocationDto checkLocationActive(long id) { using (EAharaDB context = new EAharaDB()) { if (id != 0) { var Delete = context.Locations.FirstOrDefault(x => x.Id == id); if (Delete.IsActive) { LocationDto loc = new LocationDto(); loc.Id = Delete.Id; loc.Name = Delete.Name; loc.DeliveryCharge = Delete.DeliveryCharge; loc.DeliveryRange = Delete.DeliveryRange; loc.Lng = Delete.Lng; loc.Lat = Delete.Lat; return(loc); } return(null); } } return(null); }
public List <MEDSubCategoryDto> GetSubCatByCatId(long id) { List <MEDSubCategoryDto> DtoList; using (EAharaDB context = new EAharaDB()) { var data = context.MEDSubCategories.Where(x => x.IsActive == true && x.MEDCategoryId == id) .Select(x => new MEDSubCategoryDto { Id = x.Id, Name = x.Name, IsActive = x.IsActive, Image = x.Image, MEDCategoryId = x.MEDCategoryId, MEDCategory = new MEDCategoryDto { Name = x.MEDCategory.Name, Id = x.MEDCategory.Id, }, }).ToList(); DtoList = data; } return(DtoList); }
public List <LocationDto> LocationInDropdownAdmin() { List <LocationDto> DtoList; using (EAharaDB context = new EAharaDB()) { BasicAuthenticationIdentity identity = (BasicAuthenticationIdentity)User.Identity; var user = context.Users.FirstOrDefault(x => x.Id == identity.Id); var query = context.Locations.Where(x => x.IsActive == true); if (user.Role == "Employee") { if (user.Employee != null) { query = query.Where(x => x.Id == user.Employee.LocationId); } } var data = query .Select(x => new LocationDto { Id = x.Id, IsActive = x.IsActive, Name = x.Name, Lat = x.Lat, Lng = x.Lng, DeliveryCharge = x.DeliveryCharge, DeliveryRange = x.DeliveryRange, }).ToList(); DtoList = data; } return(DtoList); }
public List <TagDto> GetItemTags(long id) { if (id > 0) { using (EAharaDB context = new EAharaDB()) { var data = context.Tags.Where(x => x.IsActive && x.ItemId == id) .Select(x => new TagDto { Id = x.Id, Description = x.Description, IsActive = x.IsActive, ItemId = x.ItemId, Item = new ItemDto { Id = x.Item != null ? x.Item.Id : 0, Name = x.Item != null ? x.Item.Name : " ", }, }).OrderByDescending(x => x.Id).ToList(); return(data); } } return(null); }
public bool makeItemInactive(long id) { using (EAharaDB context = new EAharaDB()) { if (id != 0) { var Delete = context.Items.FirstOrDefault(x => x.Id == id); if (Delete != null) { if (Delete.InActive) { Delete.InActive = false; context.Entry(Delete).Property(x => x.InActive).IsModified = true; } else { Delete.InActive = true; context.Entry(Delete).Property(x => x.InActive).IsModified = true; } } context.SaveChanges(); return(true); } } return(false); }
public DataSourceResult OffersInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var query = context.Users.Where(x => x.IsActive == true); query = query.Where(x => x.Role != "Customer"); var dataSourceResult = query .Select(x => new UserDto { Id = x.Id, UserName = x.UserName, Password = x.Password, ShopId = x.ShopId, EmployeeId = x.EmployeeId, MEDShopId = x.MEDShopId, Role = x.Role, IsActive = x.IsActive, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public ItemDto ItemsById(long id) { ItemDto ItemDto = new ItemDto(); using (EAharaDB context = new EAharaDB()) { var acctype = context.Items.FirstOrDefault(x => x.IsActive == true && x.Id == id); if (acctype != null) { ItemDto.Id = acctype.Id; ItemDto.ItemCategoryId = acctype.ItemCategoryId; ItemDto.Name = acctype.Name; ItemDto.ShopId = acctype.ShopId; ItemDto.OfferId = acctype.OfferId; ItemDto.OfferPrice = acctype.OfferPrice; ItemDto.Price = acctype.Price; ItemDto.CommissionPercentage = acctype.CommissionPercentage; ItemDto.Description = acctype.Description; ItemDto.TagLine = acctype.TagLine; ItemDto.Image = acctype.Image; ItemDto.InActive = acctype.InActive; ItemDto.Preference = acctype.Preference; ItemDto.IsActive = true; ItemDto.Offer = new OfferDto { Id = acctype.Offer != null ? acctype.Offer.Id : 0, Image = acctype.Offer != null ? acctype.Offer.Image : "", Tittle = acctype.Offer != null ? acctype.Offer.Tittle : "", Percentage = acctype.Offer != null ? acctype.Offer.Percentage : 0, }; } } return(ItemDto); }
public List <ReviewDto> getShopReviews(long id) { using (EAharaDB context = new EAharaDB()) { var dataList = context.Reviews.Where(x => x.IsActive == true && x.ShopId == id) .Select(x => new ReviewDto { Id = x.Id, Description = x.Description, Rating = x.Rating, IsActive = x.IsActive, Name = x.Name, MobileNo = x.MobileNo, EmailId = x.EmailId, ShopId = x.ShopId, Shop = new ShopDto { Id = x.Shop.Id, Name = x.Shop.Name, }, }).OrderByDescending(x => x.Id).ToList(); return(dataList); } }
public bool DeleteMEDOffers(long id) { using (EAharaDB context = new EAharaDB()) { if (id != 0) { var Delete = context.MEDOffers.FirstOrDefault(x => x.Id == id); if (Delete != null) { Delete.IsActive = false; context.Entry(Delete).Property(x => x.IsActive).IsModified = true; var items = context.MEDItems.Where(x => x.IsActive && x.MEDOfferId == id).ToList(); foreach (var i in items) { i.MEDOfferId = null; context.Entry(i).Property(x => x.MEDOfferId).IsModified = true; i.OfferPrice = i.Price; context.Entry(i).Property(x => x.OfferPrice).IsModified = true; } } context.SaveChanges(); return(true); } } return(false); }
public DataSourceResult ReviewsInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.Reviews.Where(x => x.IsActive == true) .Select(x => new ReviewDto { Id = x.Id, Description = x.Description, Rating = x.Rating, IsActive = x.IsActive, ShopId = x.ShopId, Name = x.Name, MobileNo = x.MobileNo, EmailId = x.EmailId, Shop = new ShopDto { Id = x.Shop.Id, Name = x.Shop.Name, }, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public DataSourceResult MEDOffersInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.MEDOffers.Where(x => x.IsActive == true) .Select(x => new MEDOfferDto { Id = x.Id, Title = x.Title, Image = x.Image, Percentage = x.Percentage, MEDShopId = x.MEDShopId, IsActive = x.IsActive, MEDShop = new MEDShopDto { Id = x.MEDShop != null ? x.MEDShop.Id : 0, Name = x.MEDShop != null ? x.MEDShop.Name : "", }, IsPercentage = x.IsPercentage, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public DataSourceResult ShopMenuInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.ShopMenus.Where(x => x.IsActive == true) .Select(x => new ShopMenuDto { Id = x.Id, Tittle = x.Tittle, Image = x.Image, IsActive = x.IsActive, ShopId = x.ShopId, Shop = new ShopDto { Id = x.Shop.Id, Name = x.Shop.Name, }, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }
public DataSourceResult OffersInView(DataSourceRequest Request) { using (EAharaDB context = new EAharaDB()) { var dataSourceResult = context.PromoOffers.Where(x => x.IsActive == true) .Select(x => new PromoOfferDto { Id = x.Id, Tittle = x.Tittle, Image = x.Image, Value = x.Value, Count = x.Count, IsPercentage = x.IsPercentage, MaxValue = x.MaxValue, Code = x.Code, IsActive = x.IsActive, }).OrderByDescending(x => x.Id).ToDataSourceResult(Request); DataSourceResult kendoResponseDto = new DataSourceResult(); kendoResponseDto.Data = dataSourceResult.Data; kendoResponseDto.Aggregates = dataSourceResult.Aggregates; kendoResponseDto.Total = dataSourceResult.Total; return(kendoResponseDto); } }