Пример #1
0
        public ActionResult Category()
        {
            List <CategoryMaster> lst = new List <CategoryMaster>();

            lst = Commonhelper.GetCategory();
            return(View(lst));
        }
Пример #2
0
        public async System.Threading.Tasks.Task <ActionResult> GetSubcategory(string category)
        {
            List <DropDownControl> dopdownlst = new List <DropDownControl>();

            dopdownlst = Commonhelper.GetSubCategoryByCategory(category);
            return(Json(dopdownlst, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult EditCategory(string Id)
        {
            CategoryMaster c = new CategoryMaster();

            c = Commonhelper.GetCategoryById(Id);
            return(View(c));
        }
Пример #4
0
        public async System.Threading.Tasks.Task <ActionResult> DeleteItem(string Id)
        {
            bool   status = false;
            string msg    = string.Empty;

            try
            {
                try
                {
                    Commonhelper.DeleteItemById(Id);
                    msg    = "Item delete successfully!";
                    status = true;
                }
                catch (Exception ex)
                {
                    msg    = "Error in processing";
                    status = false;
                }
            }
            catch (Exception ex)
            {
                msg    = "Error in processing";
                status = false;
            }
            return(Json(new { status, msg }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public async System.Threading.Tasks.Task <ActionResult> EditColor(string Id)
        {
            ColorMaster _master = new ColorMaster();

            _master = Commonhelper.GetColorById(Id);
            return(View(_master));
        }
        public ActionResult UpdateField(OptionalFields field)
        {
            List <string> res    = new List <string>();
            bool          status = false;

            if (ModelState.IsValid)
            {
                try
                {
                    Commonhelper.UpdateFieldbyId(field);
                    res.Add("Update Successfully.");
                    status = true;
                }
                catch (Exception ex)
                {
                    res.Add("Error in Field updation!");
                    status = false;
                }
            }
            else
            {
                foreach (var modelState in ModelState.Values)
                {
                    foreach (var modelError in modelState.Errors)
                    {
                        res.Add(modelError.ErrorMessage);
                    }
                }
            }
            return(Json(new { res, status }, JsonRequestBehavior.AllowGet));
        }
        public async System.Threading.Tasks.Task <ActionResult> getCitybyState(string stateId)
        {
            List <SelectListItem> _lst = new List <SelectListItem>();

            _lst = Commonhelper.getCity(stateId);
            return(Json(_lst, JsonRequestBehavior.AllowGet));
        }
        public async Task <ActionResult> Register(ApplicationUser model)
        {
            if (ModelState.IsValid)
            {
                Guid CompanyId = new Guid();
                if (Request.Cookies["CompanyId"] != null)
                {
                    CompanyId = new Guid(Commonhelper.GetCookie("CompanyId"));
                }

                var user = new ApplicationUser {
                    UserName = model.UserName, Email = model.Email, Password = model.Password, FirstName = model.FirstName, LastName = model.LastName, MobileNo = model.MobileNo, createdby = User.Identity.GetUserId(), Datecreated = DateTime.Now, Status = true, StoreId = model.StoreId, CompanyId = CompanyId.ToString(), RegisteredDeailer = false, TaxExempted = false, IsVendor = false, IsRetailCustomer = false, IsWholeCustomer = false, UserExpiry = model.UserExpiry
                };

                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    /////await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                    var Usermanager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
                    Usermanager.AddToRole(user.Id, model.UserRole);
                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("RegisteredAccounts"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public async System.Threading.Tasks.Task <ActionResult> GetItemDetailById(string Id)
        {
            ItemMaster _items = new ItemMaster();

            _items = Commonhelper.GetItemById(Id);
            return(Json(_items, JsonRequestBehavior.AllowGet));
        }
Пример #10
0
        public async System.Threading.Tasks.Task <ActionResult> UpdateColorMaster(ColorMaster _color)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            try
            {
                ColorMaster master = new ColorMaster();
                master.Id            = _color.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = _color.Name;
                master.Description   = _color.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.Updatecolor(master);
                    return(RedirectToAction("ColorMaster"));
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("ColorMaster"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Error in category creation!');</script>"));
            }
        }
Пример #11
0
        public async System.Threading.Tasks.Task <ActionResult> EditBrand(string Id)
        {
            BrandMaster _master = new BrandMaster();

            _master = Commonhelper.GetBrandById(Id);
            return(View(_master));
        }
Пример #12
0
        public async System.Threading.Tasks.Task <ActionResult> UpdateBrandMaster([DataSourceRequest] DataSourceRequest request, BrandMaster _brand)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();
            BrandMaster   master      = new BrandMaster();

            try
            {
                master.Id            = _brand.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = _brand.Name;
                master.CheckName     = _brand.Name;
                master.Description   = _brand.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.UpdateBrand(master);
                    return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
                }
                catch (Exception ex)
                {
                    return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
                }
            }
            catch (Exception ex)
            {
                return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
            }
        }
        public ActionResult UserPermission(Permissionviewmodel vm, string Search, string Save)
        {
            List <string>           result      = new List <string>();
            PermissionMaster        _master     = new PermissionMaster();
            List <ModulePermission> p           = new List <ModulePermission>();
            Permissionviewmodel     searchmodel = new Permissionviewmodel();

            Guid CompanyId = new Guid();

            if (Request.Cookies["CompanyId"] != null)
            {
                CompanyId = new Guid(Commonhelper.GetCookie("CompanyId"));
            }
            if (vm.PermissionMaster != null)
            {
                _master.Id          = Guid.NewGuid().ToString();
                _master.CompanyId   = CompanyId.ToString();
                _master.UserId      = vm.PermissionMaster.UserId;
                _master.CreatedBy   = User.Identity.GetUserId();
                _master.DateCreated = DateTime.Now;
                _master.Workstation = Commonhelper.GetStation();
            }
            if (vm.Menumaster.Count() > 0)
            {
                foreach (var item in vm.Menumaster)
                {
                    foreach (var child in item._SubMenumaster)
                    {
                        if (child.IsAdd == true || child.IsEdit == true || child.Isview == true || child.Isdelete == true)
                        {
                            ModulePermission mp = new ModulePermission();
                            mp.Id           = Guid.NewGuid().ToString();
                            mp.MenuId       = item.MenuId;
                            mp.SubMenuId    = child.SubMenumasterId;
                            mp.IsAdd        = child.IsAdd;
                            mp.IsEdit       = child.IsEdit;
                            mp.Isview       = child.Isview;
                            mp.Isdelete     = child.Isdelete;
                            mp.DisplayOrder = child.order;
                            mp.Displayclass = child.Displayclass;
                            mp.DisplayName  = child.DisplayName;
                            _master._ModulePermission.Add(mp);
                        }
                    }
                }
                try
                {
                    Commonhelper.SavePermission(_master);
                    return(Content("<script language='javascript' type='text/javascript'>alert('permission saved successfully!');</script>"));
                }
                catch (Exception ex)
                {
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));



            ///return View();
        }
Пример #14
0
        public async System.Threading.Tasks.Task <ActionResult> EditSubcategory(string Id)
        {
            SubCategoryMaster _master = new SubCategoryMaster();

            _master = Commonhelper.GetSubCategoryById(Id);
            return(View(_master));
        }
Пример #15
0
        public ActionResult CreateItem()
        {
            ItemMaster _ItemMaster = new ItemMaster();

            _ItemMaster.ItemOptionalDetails = Commonhelper.GetOptionalFieldsList();
            return(View(_ItemMaster));
        }
        // GET: Setting
        public ActionResult Index()
        {
            List <OptionalFields> lst = new List <OptionalFields>();

            lst = Commonhelper.GetOptionalList();
            return(View(lst));
        }
        public ActionResult Update(ApplicationUser _user)
        {
            //The model is valid - update the product and redisplay the grid.
            using (var ctx = new ApplicationDbContext())
            {
                ApplicationUser user = new ApplicationUser();
                user = ctx.Users.Where(x => x.Id == _user.Id).FirstOrDefault();
                if (user != null)
                {
                    user.FirstName = _user.FirstName;
                    user.LastName  = _user.LastName;
                    user.Status    = _user.Status;
                    user.UserRole  = _user.UserRole;
                    user.MobileNo  = _user.MobileNo;
                }
                var    Usermanager      = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
                string Existinguserrole = string.Empty;
                Existinguserrole = Commonhelper.Rolename(_user.UserRole);
                Usermanager.RemoveFromRole(user.Id, Existinguserrole);
                Usermanager.AddToRole(user.Id, _user.UserRoleName);
                ctx.Entry(user).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            //GridRouteValues() is an extension method which returns the
            //route values defining the grid state - current page, sort expression, filter etc.
            RouteValueDictionary routeValues = this.GridRouteValues();

            return(RedirectToAction("RegisteredAccounts"));
        }
Пример #18
0
        // ReSharper disable once TooManyDeclarations
        private async void  ThreadProc(object state)
        {
            try
            {
                string        imei;
                var           client = (TcpClient)state;
                byte[]        buffer = new byte[client.ReceiveBufferSize];
                NetworkStream stream = ((TcpClient)state).GetStream();
                stream.Read(buffer, 0, client.ReceiveBufferSize);
                imei = CleanInput(Encoding.ASCII.GetString(buffer.ToArray()).Trim());
                if (Commonhelper.IsValidImei(imei))
                {
                    await ParseAvlDataAsync(client, stream, imei).ConfigureAwait(false);
                }
            }
            catch (InvalidCastException e)
            {
                Trace.TraceWarning(e.Message);
                _log.Error($"{DateTime.Now} -Error message : {e.Message}  details : {e.InnerException?.Message}");
            }
            catch (Exception e)
            {
                Trace.TraceWarning(e.Message);
                _log.Error($"{DateTime.Now} -Error message : {e.Message}  details : {e.InnerException?.Message}");

                //throw;
            }
        }
Пример #19
0
        public async System.Threading.Tasks.Task <ActionResult> Subcategory()
        {
            List <SubCategoryMaster> _master = new List <SubCategoryMaster>();

            _master = Commonhelper.GetSubCategory();

            return(View(_master));
        }
Пример #20
0
        public async System.Threading.Tasks.Task <ActionResult> ColorMaster()
        {
            List <ColorMaster> _master = new List <ColorMaster>();

            _master = Commonhelper.GetColor();

            return(View(_master));
        }
Пример #21
0
        private static IEnumerable <ItemMaster> GetItemMaster()
        {
            List <ItemMaster> itemlst = new List <ItemMaster>();

            itemlst = Commonhelper.GetItemMaster();

            return(itemlst);
        }
        public ActionResult UserLevelPermission()
        {
            List <PermissionMaster> _Permission = new List <PermissionMaster>();

            _Permission = Commonhelper.GetpermissionList();

            return(View(_Permission));
        }
        public ActionResult EditPermission(Guid Id)
        {
            PermissionMaster    _Permission = new PermissionMaster();
            Permissionviewmodel vm          = new Permissionviewmodel();

            vm        = Commonhelper.GetpermissionById(Id);
            vm.UserId = Id.ToString();
            return(View(vm));
        }
Пример #24
0
        private static IEnumerable <SubCategoryMaster> GetSubCategory()
        {
            List <SubCategoryMaster> lst = new List <SubCategoryMaster>();

            using (var ctx = new ApplicationDbContext())
            {
                lst = Commonhelper.GetSubCategory();
            }

            return(lst);
        }
Пример #25
0
        private static IEnumerable <ColorMaster> GetColorMaster()
        {
            List <ColorMaster> _master = new List <ColorMaster>();

            using (var ctx = new ApplicationDbContext())
            {
                _master = Commonhelper.GetColor();
            }

            return(_master);
        }
Пример #26
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var    Usermanager = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var    currentuser = Usermanager.FindByName(HttpContext.Current.User.Identity.Name);
            var    lst         = httpContext.Request.RequestContext.RouteData.Values.Values.ToList();
            object actionname  = lst[1];
            bool   check       = false;

            check = Commonhelper.checkpermission(currentuser.Id, Action, Permission);
            return(check);
            //check your permissions
        }
Пример #27
0
        public string GetIMEI(byte[] buffer, int recievedBytes)
        {
            var imei         = string.Empty;
            var dataReceived = Encoding.ASCII.GetString(buffer, 2, recievedBytes);

            if (imei != string.Empty || !Commonhelper.IsValidImei(dataReceived))
            {
                return(imei);
            }
            imei = dataReceived;
            return(imei);
        }
        private static IEnumerable <ApplicationUser> GetUsers()
        {
            List <ApplicationUser> _user    = new List <ApplicationUser>();
            List <ApplicationUser> _userlst = new List <ApplicationUser>();

            using (var ctx = new ApplicationDbContext())
            {
                _user = ctx.Users.Include(x => x._CompanyMaster).Include(x => x._StoreMaster).Include(x => x.Roles).ToList();
            }
            if (_user.Count > 0)
            {
                _userlst.Clear();
                foreach (var item in _user)
                {
                    ApplicationUser user = new ApplicationUser();
                    user.Id          = item.Id;
                    user.UserName    = item.UserName;
                    user.FirstName   = item.FirstName;
                    user.LastName    = item.LastName;
                    user.CompanyName = item._CompanyMaster.CompanyName;
                    if (item.StoreId != null)
                    {
                        user.StoreId   = item.StoreId;
                        user.StoreName = item._StoreMaster.StoreName;
                    }
                    else
                    {
                        user.StoreId   = "0";
                        user.StoreName = "N/A";
                    }
                    if (item.Status == true)
                    {
                        user.Status     = true;
                        user.StatusName = "Active";
                    }
                    else
                    {
                        user.Status     = false;
                        user.StatusName = "In Active";
                    }
                    user.MobileNo       = item.MobileNo;
                    user.ExistsMobileNo = item.MobileNo;

                    user.UserRoleName = Commonhelper.getrolenameById(item.Roles.FirstOrDefault().RoleId);
                    user.UserRole     = item.Roles.FirstOrDefault().RoleId;
                    _userlst.Add(user);
                }
            }
            return(_userlst);
        }
        public PartialViewResult GetMenu(string UserId)
        {
            Permissionviewmodel vm   = new Permissionviewmodel();
            List <Menumaster>   _lst = new List <Menumaster>();

            if (UserId == null)
            {
                vm = Commonhelper.Getmenu();
            }
            else
            {
                // vm = Commonhelper.Getmenu(UserId);
            }
            return(PartialView("_Permission", vm));
        }
        public JsonResult Checkmobile(string MobileNo, string previousnumber)
        {
            if (MobileNo == previousnumber)
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            bool check = Commonhelper.Checkmobile(MobileNo);

            if (check)
            {
                return(Json("Mobile no in use.", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
        }