예제 #1
0
        public Credentials GetLoginInfo(string mobileNumber, string password)
        {
            var credentials = new Credentials();

            using (var entities = new BrandOutletMonitoringEntities())
            {
                var userDate =
                    entities.BrandLogins.FirstOrDefault(
                        a => a.Mobile == mobileNumber && a.Password == password && a.Active == true);

                if (userDate != null)
                {
                    credentials.status      = "1";
                    credentials.employeeid  = userDate.Id.ToString();
                    credentials.phoneNumber = userDate.Mobile;
                    credentials.usertype    = userDate.UserType;
                }


                else
                {
                    credentials.status = "0";

                    credentials.errormsg = "Invalid Username/Password";
                }
            }

            return(credentials);
        }
예제 #2
0
        public Credentials GetLoginInfo()
        {
            var credentials = new Credentials();
            var entities    = new BrandOutletMonitoringEntities();

            return(credentials);
        }
예제 #3
0
        public BrandSubCategoryModel[] GetSubCategoryModels(string categoryId)
        {
            try
            {
                using (var bmEntity = new BrandOutletMonitoringEntities())
                {
                    var id = Convert.ToInt64(categoryId);

                    var subCategoryList = bmEntity.BrandMonitorSubCategories.Where(a => a.BrandMonitorId == id).ToList();

                    var list = new List <BrandSubCategoryModel>();

                    foreach (var items in subCategoryList)
                    {
                        var br = new BrandSubCategoryModel();
                        br.id = items.Id.ToString();
                        br.subcategoryname = items.Name;
                        br.brandmonitorid  = items.BrandMonitorId.ToString();
                        br.duration        = (items.Duration + "-" + items.DurationType);
                        br.active          = items.Active.ToString();
                        br.validityover    = items.ValidityOver.ToString();
                        list.Add(br);
                    }



                    return(list.ToArray());
                }
            }
            catch (Exception ex)
            {
                throw new CultureNotFoundException("Error Occured While Getting Information");
            }
        }
예제 #4
0
        public bool InsertNewBrandOutletMasterDetailsInfo(List <NewBrandOutletModel> newBrandOutlet, Guid?tokenNumber)
        {
            try
            {
                using (var entity = new BrandOutletMonitoringEntities())
                {
                    foreach (var newBrandOutletModel in newBrandOutlet)
                    {
                        var outletMaster = new BrandOutletDetail();
                        outletMaster.BrandOutletToken     = tokenNumber;
                        outletMaster.RetailerId           = newBrandOutletModel.RetailerId;
                        outletMaster.BrandCategoryId      = newBrandOutletModel.BrandCategoryId;
                        outletMaster.BrandCategoryName    = newBrandOutletModel.BrandCategoryName;
                        outletMaster.BrandSubCategoryId   = newBrandOutletModel.BrandSubCategoryId;
                        outletMaster.BrandSubCategoryName = newBrandOutletModel.BrandSubCategoryName;
                        outletMaster.Quantity             = newBrandOutletModel.Quantity;
                        outletMaster.AddedBy     = 1;
                        outletMaster.AddedDate   = DateTime.Now;
                        outletMaster.UpdatedBy   = 1;
                        outletMaster.UpdatedDate = DateTime.Now;

                        entity.BrandOutletDetails.Add(outletMaster);
                    }

                    entity.SaveChanges();
                }

                return(true);
            }
            catch (Exception exception)
            {
                return(false);
            }
        }
예제 #5
0
        public bool InsertNewBrandOutletMasterInfo(List <NewBrandOutletModel> newBrandOutlet, Guid?tokenNumber)
        {
            try
            {
                using (var entity = new BrandOutletMonitoringEntities())
                {
                    var outletMaster = new BrandOutletMaster();
                    outletMaster.OutletToken     = tokenNumber;
                    outletMaster.RetailerId      = newBrandOutlet[0].RetailerId;
                    outletMaster.RetailerName    = newBrandOutlet[0].RetailerName;
                    outletMaster.RetailerAddress = newBrandOutlet[0].RetailerAddress;
                    outletMaster.RetailerPhone   = newBrandOutlet[0].RetailerPhone;
                    outletMaster.AddedBy         = 1;
                    outletMaster.Active          = true;
                    outletMaster.AddedDate       = DateTime.Now;
                    entity.BrandOutletMasters.Add(outletMaster);



                    entity.SaveChanges();
                }

                return(true);
            }
            catch (Exception exception)
            {
                return(false);
            }
        }
예제 #6
0
        public BrandCategory[] GetOffersModelPrice()
        {
            try
            {
                using (var bpEntity = new BrandOutletMonitoringEntities())
                {
                    var cellPhonePricingList = bpEntity.BrandMonitorCategories.ToList();

                    var list = new List <BrandCategory>();

                    foreach (var brandMonitorCategory in cellPhonePricingList)
                    {
                        var br = new BrandCategory();
                        br.name = brandMonitorCategory.Name;
                        br.type = brandMonitorCategory.Type;
                        br.id   = brandMonitorCategory.Id.ToString();
                        list.Add(br);
                    }



                    return(list.ToArray());
                }
            }
            catch (Exception ex)
            {
                throw new CultureNotFoundException("Error Occured While Getting Information");
            }
        }
예제 #7
0
        public BrandSubCategoryModel GetSalesReport()
        {
            var subCategory = new BrandSubCategoryModel();
            var entities    = new BrandOutletMonitoringEntities();

            // credentials.Data = _entities.tblProductRegistrations.ToList();
            return(subCategory);
        }
        //public ActionResult DiisplayingImage(int id)
        //{
        //    var img = new List<tblImageUploader>();
        //    try
        //    {
        //        img = _adminManager.DisplayingImage(id);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    return File(img.ImageId, "image/jpg");
        //    //return File(list, JsonRequestBehavior.AllowGet);
        //}
        public ActionResult DisplayingImage(int imgid)
        {
            var db = new BrandOutletMonitoringEntities();


            var img = db.tblImageUploaders.SingleOrDefault(x => x.Id == imgid);

            return(File(img.ImageByte, "image/jpg"));
        }
예제 #9
0
        public ActionResult GetIssueSolvedDetails(Guid?id)
        {
            var _entities = new BrandOutletMonitoringEntities();


            var brandissueDetails = (from v in _entities.BrandIssueMasters
                                     join brandsub in _entities.BrandMonitorSubCategories on v.SubCategoryId equals brandsub.Id
                                     join brandcat in _entities.BrandMonitorCategories on v.CategoryId equals brandcat.Id
                                     where v.IssueId == id && v.Solved == true
                                     select new BrandingIssueModel
            {
                IssueId = v.IssueId,
                BrandSubCategory = brandsub.Name,
                BrandCategory = brandcat.Name,
                RetailerPhone = v.RetailersPhone,
                RetailerAddress = v.RetailersAddress,
                Description = v.Description,
            }).ToList();

            var brandIssueSolvedDetails = (from v in _entities.BrandingIssuesSolveds
                                           where v.IssueId == id

                                           select new BrandingIssueModel
            {
                IssueId = v.IssueId,
                Remarks = v.Remarks,
                Solutions = v.Solutions,
                AddedBy = v.AddedBy,
                AddedDate = v.AddedDate,
            }).ToList();


            var img = (from v in _entities.BrandingIssues

                       where v.BrandIssueId == id
                       select new BrandingIssueModel
            {
                IssueFile = v.IssueFile
            }).ToList();

            foreach (var item in img)
            {
                item.IssueFile     = GetFile(item.IssueFile);
                item.FileExtension = GetExtension(item.IssueFile);
            }



            ViewBag.Datas            = img;
            ViewBag.brandIssueSolved = brandIssueSolvedDetails;
            ViewBag.BrandIssue       = brandissueDetails;



            return(View());
        }
예제 #10
0
        public List <BrandMonitorSubCategory> GetBrandSubCategory(long id)
        {
            List <BrandMonitorSubCategory> subCategories;

            using (var entity = new BrandOutletMonitoringEntities())
            {
                subCategories = entity.BrandMonitorSubCategories.Where(a => a.BrandMonitorId == id).ToList();
            }
            return(subCategories);
        }
예제 #11
0
        public List <BrandOutletDetail> BrandOutletDetails(Guid?token)
        {
            List <BrandOutletDetail> details;

            using (var entity = new BrandOutletMonitoringEntities())
            {
                details = entity.BrandOutletDetails.Where(a => a.BrandOutletToken == token).ToList();
            }
            return(details);
        }
예제 #12
0
        public ActionResult BrandOutletDetailsData(Guid?id)
        {
            var _entities = new BrandOutletMonitoringEntities();

            var brandOutletDetails = _entities.BrandOutletDetails.ToList();

            ViewBag.Brandoutlet = brandOutletDetails;

            return(View());
        }
예제 #13
0
        public List <BrandMonitorCategory> GetBrandCategoryDetails(string term)
        {
            List <BrandMonitorCategory> categories;

            using (var entity = new BrandOutletMonitoringEntities())
            {
                categories =
                    entity.BrandMonitorCategories.Where(a => a.Name.ToLower().Contains(term.ToLower())).ToList();
            }
            return(categories);
        }
예제 #14
0
        public JsonResult GetData()
        {
            var _entities = new BrandOutletMonitoringEntities();

            var img = _entities.BrandingIssues.ToList();

            var jsonResult = Json(img, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
예제 #15
0
        public List <BrandOutletMaster> GetOutetRetailers(string term)
        {
            List <BrandOutletMaster> retailers;

            using (var entity = new BrandOutletMonitoringEntities())
            {
                retailers =
                    entity.BrandOutletMasters.Where(
                        a => a.RetailerName.ToLower().Contains(term.ToLower()) && a.Active == true).ToList();
            }
            return(retailers);
        }
예제 #16
0
        public bool UpdateBrandOutletMasterDetailsInfo(List <NewBrandOutletModel> reBrandItems)
        {
            try
            {
                using (var entity = new BrandOutletMonitoringEntities())
                {
                    foreach (var items in reBrandItems)
                    {
                        var shopInfoes = entity.BrandOutletDetails.FirstOrDefault(x => x.BrandOutletToken == items.Token &&
                                                                                  x.BrandCategoryId == items.BrandCategoryId && x.BrandSubCategoryId == items.BrandSubCategoryId);
                        if (shopInfoes != null)
                        {
                            if (items.Quantity != 0)
                            {
                                shopInfoes.Quantity = items.Quantity;
                            }


                            shopInfoes.UpdatedBy   = 1;
                            shopInfoes.UpdatedDate = DateTime.Now;


                            entity.Entry(shopInfoes).State = EntityState.Modified;
                        }


                        entity.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }


            return(true);
        }
예제 #17
0
        public int UploadImageInDataBase(HttpPostedFileBase file, BrandingIssue contentViewModel)
        {
            var _entities = new BrandOutletMonitoringEntities();
            //contentViewModel.IssueFile = ConvertToBytes(file);
            var Content = new BrandingIssue
            {
                //BrandId = contentViewModel.BrandId,
                //Description = contentViewModel.Description,
                //SubCategoryid = contentViewModel.SubCategoryid,
                IssueFile = contentViewModel.IssueFile
            };

            _entities.BrandingIssues.Add(Content);
            int i = _entities.SaveChanges();

            if (i == 1)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
예제 #18
0
 public BrandRepository()
 {
     _entities = new BrandOutletMonitoringEntities();
 }
예제 #19
0
        public Result PostDescription()
        {
            var masterResult = new Result();
            var result       = new Result();

            var brandingIssue       = new BrandingIssue();
            var brandingIssueMaster = new BrandIssueMaster();

            const string initialPath = @"~/Content/UploadImage";


            try
            {
                //****Posted Files
                //****Posted Files

                var httpPostedFile = HttpContext.Current.Request.Files;
// ReSharper disable once AssignNullToNotNullAttribute
                var strings             = HttpContext.Current.Request.Form.GetValues("desc").ToList();
                var stringsAddress      = HttpContext.Current.Request.Form.GetValues("add");
                var stringPhone         = HttpContext.Current.Request.Form.GetValues("phone");
                var stringSubcategoryId = HttpContext.Current.Request.Form.GetValues("subcategoryid");
                var stringCategoryId    = HttpContext.Current.Request.Form.GetValues("categoryid");

                //Strings Bind

                //string bind

                string description = null;
                string address     = null;
                string phone       = null;

                long?categoryid    = null;
                long?subcategoryid = null;
                if (strings != null)
                {
                    description = strings[0];
                }

                if (stringsAddress != null)
                {
                    address = stringsAddress[0];
                }

                if (stringPhone != null)
                {
                    phone = stringPhone[0];
                }

                if (stringSubcategoryId != null)
                {
                    subcategoryid = Convert.ToInt64(stringSubcategoryId[0]);
                }

                if (stringCategoryId != null)
                {
                    categoryid = Convert.ToInt64(stringCategoryId[0]);
                }



                //****Posted Files
                //****Posted Files
                // Get the uploaded image from the Files collection
                // Get the uploaded image from the Files collection
                var bmEntity = new BrandOutletMonitoringEntities();

                var issueToken = Guid.NewGuid();


                brandingIssueMaster.IssueId          = issueToken;
                brandingIssueMaster.CategoryId       = categoryid;
                brandingIssueMaster.SubCategoryId    = subcategoryid;
                brandingIssueMaster.Description      = description;
                brandingIssueMaster.RetailersPhone   = phone;
                brandingIssueMaster.RetailersAddress = address;
                brandingIssueMaster.Active           = true;
                brandingIssueMaster.AddedDate        = DateTime.Now;

                bmEntity.BrandIssueMasters.Add(brandingIssueMaster);
                masterResult.issuccess = bmEntity.SaveChanges();
                if (masterResult.issuccess == 1)
                {
                    result.error   = false;
                    result.message = "Uploaded Successfully";

                    if (HttpContext.Current.Request.Files.AllKeys.Any())
                    {
                        for (var iCnt = 0; iCnt <= httpPostedFile.Count - 1; iCnt++)
                        {
                            var postedFile = httpPostedFile[iCnt];

                            var fileName = Path.GetFileName(postedFile.FileName);


                            if (fileName != null)
                            {
                                var todayTime = DateTime.Now;
                                var time      = new DateTime(todayTime.Year, todayTime.Month, todayTime.Day,
                                                             todayTime.Hour,
                                                             todayTime.Minute, todayTime.Second, todayTime.Millisecond);
                                var timeFormat = string.Format("{0:yyyy-MM-dd_hh-mm-ss-fff}", time);
                                fileName = timeFormat + "-" + fileName;
                                var path = Path.Combine(HttpContext.Current.Server.MapPath(initialPath), fileName);
                                postedFile.SaveAs(path);


                                string finalPath = @"C:\uploads" + @"\" + 1 + @"\" + 2 + @"\" + 3;
                                if (Directory.Exists(finalPath))
                                {
                                    File.Copy(path, finalPath + "\\" + fileName, true);
                                }
                                else
                                {
                                    Directory.CreateDirectory(finalPath);
                                    File.Copy(path, finalPath + "\\" + fileName, true);
                                }

                                brandingIssue.BrandIssueId = issueToken;
                                brandingIssue.IssueFile    = finalPath + "\\" + fileName;
                                bmEntity.BrandingIssues.Add(brandingIssue);
                                bmEntity.SaveChanges();

                                result.error   = false;
                                result.message = "Uploaded Successfully";
                            }
                        }
                    }
                }

                else
                {
                    result.error   = true;
                    result.message = "Uploaded Failed";
                }


                //var httpPostedFile = HttpContext.Current.Request.Files["upload"];
                //
            }
            catch (Exception)
            {
                result.error   = true;
                result.message = "Uploaded Failed";
            }


            return(result);
        }
        public ActionResult LogIn(LoginModel login)
        {
            if (ModelState.IsValid) //validating the user inputs
            {
                bool isExist = false;
                using (var entity = new BrandOutletMonitoringEntities())                                                                                   //
                {
                    isExist = entity.BrandLogins.Any(x => x.UserName.Trim().ToLower() == login.UserName.Trim().ToLower() && x.Password == login.Password); //validating the user name in tblLogin table whether the user name is exist or not
                    if (isExist)
                    {
                        var loginCredentials = entity.BrandLogins.Where(x => x.UserName.Trim().ToLower() == login.UserName.Trim().ToLower()).Select(x => new LoginModel
                        {
                            Id           = x.Id,
                            UserName     = x.UserName,
                            Email        = x.Email,
                            Mobile       = x.Mobile,
                            EmployeeName = x.Name,
                            EmployeeId   = x.EmployeeId,
                            UserRoleId   = x.RoleId
                        }).FirstOrDefault();



                        List <MenuModel> menus = entity.BrandSubMenus.Where(x => x.RoleId == loginCredentials.UserRoleId && x.IsMenue == true).Select(x => new MenuModel
                        {
                            MainMenuId     = x.BrandMainMenu.Id,
                            MainMenuName   = x.BrandMainMenu.MainMenu,
                            SubMenuId      = x.Id,
                            SubMenuName    = x.SubMenu,
                            ControllerName = x.Controller,
                            ActionName     = x.Action,
                            RoleId         = x.RoleId
                        }).ToList(); //Get the Menu details

                        List <MenuModel> permissions = entity.BrandSubMenus.Where(x => x.RoleId == loginCredentials.UserRoleId || x.RoleId == 0).Select(x => new MenuModel
                        {
                            MainMenuId     = x.BrandMainMenu.Id,
                            MainMenuName   = x.BrandMainMenu.MainMenu,
                            SubMenuId      = x.Id,
                            SubMenuName    = x.SubMenu,
                            ControllerName = x.Controller,
                            ActionName     = x.Action,
                            RoleId         = x.RoleId
                        }).ToList(); //Get the Menu details


                        FormsAuthentication.SetAuthCookie(loginCredentials.UserName, false); // set the formauthentication cookie


                        Session["LoginCredentials"] = loginCredentials; //
                        Session["MenuMaster"]       = menus;            //
                        Session["permissions"]      = permissions;      //

                        System.Web.HttpContext.Current.Session["BrandLoginUserId"]         = loginCredentials.Id;
                        System.Web.HttpContext.Current.Session["BrandLoginUserName"]       = loginCredentials.UserName;
                        System.Web.HttpContext.Current.Session["BrandLoginUserEmployeeId"] = loginCredentials.EmployeeId;
                        System.Web.HttpContext.Current.Session["BrandLoginEmployeeName"]   = loginCredentials.EmployeeName;
                        System.Web.HttpContext.Current.Session["BrandLoginEmployeeMobile"] = loginCredentials.Mobile;
                        System.Web.HttpContext.Current.Session["BrandLoginEmployeeEmail"]  = loginCredentials.Email;


                        return(RedirectToAction("Home", "Brand"));
                    }
                    else
                    {
                        ViewBag.ErrorMsg = "Please enter the valid credentials!";
                        return(View());
                    }
                }
            }
            return(View());

            //return RedirectToAction("Index", "Home");
        }
 public BarandingIssueSolvedRepository()
 {
     _entities = new BrandOutletMonitoringEntities();
 }