Exemplo n.º 1
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>"));
            }
        }
        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();
        }
Exemplo n.º 3
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)));
            }
        }
Exemplo n.º 4
0
        public async System.Threading.Tasks.Task <ActionResult> CreateBrandMaster(BrandMaster _brand)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            if (ModelState.IsValid)
            {
                try
                {
                    BrandMaster master = new BrandMaster();
                    master.Id            = Guid.NewGuid().ToString();
                    master.CreatedBy     = currentuser.Id;
                    master.CreatedDate   = DateTime.Now;
                    master.Name          = _brand.Name;
                    master.Description   = _brand.Description;
                    master.StoreId       = currentuser.StoreId;
                    master.workstation   = Commonhelper.GetStation();
                    master.FinancialYear = DateTime.Now.Year;
                    master.CompanyId     = currentuser.CompanyId;
                    master.Isactive      = true;
                    try
                    {
                        Commonhelper.SaveBrand(master);
                        return(RedirectToAction("BrandMaster"));
                    }
                    catch (Exception ex)
                    {
                        return(RedirectToAction("BrandMaster"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("BrandMaster"));
                }
            }
            else
            {
            }

            return(Json(res));

            return(View());
        }
Exemplo n.º 5
0
        public ActionResult CreateCategory(CategoryMaster category)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            if (ModelState.IsValid)
            {
                try
                {
                    CategoryMaster master = new CategoryMaster();
                    master.Id            = Guid.NewGuid().ToString();
                    master.CreatedBy     = currentuser.Id;
                    master.CreatedDate   = DateTime.Now;
                    master.Name          = category.Name;
                    master.Discount      = category.Discount;
                    master.StoreId       = currentuser.StoreId;
                    master.workstation   = Commonhelper.GetStation();
                    master.FinancialYear = DateTime.Now.Year;
                    master.CompanyId     = currentuser.CompanyId;
                    master.Isactive      = true;
                    try
                    {
                        Commonhelper.SaveCategory(master);
                        return(RedirectToAction("Category"));
                    }
                    catch (Exception ex)
                    {
                        return(RedirectToAction("Category"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Category"));
                }
            }
            else
            {
            }

            return(RedirectToAction("Category"));
        }
Exemplo n.º 6
0
        public ActionResult UpdateSubcategory([DataSourceRequest] DataSourceRequest request, SubCategoryMaster subcategory)
        {
            List <string>     res         = new List <string>();
            var               currentuser = Commonhelper.GetCurrentUserDetails();
            SubCategoryMaster master      = new SubCategoryMaster();

            try
            {
                master.Id            = subcategory.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = subcategory.Name;
                master.CheckName     = subcategory.Name;
                master.CategoryName  = Commonhelper.GetCategoryName(subcategory.CategoryId);
                master.CategoryId    = subcategory.CategoryId;
                master.Description   = subcategory.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.UpdateSubCategory(master);
                    return(Json(new[] { master }.ToDataSourceResult(request)));
                    /// return RedirectToActionPermanent("SubCategory_Read");
                    ///  return RedirectToAction("Subcategory");
                }
                catch (Exception ex)
                {
                    return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
                }
            }
            catch (Exception ex)
            {
                return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
            }
        }
Exemplo n.º 7
0
        public ActionResult UpdateCategory(CategoryMaster category)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            try
            {
                CategoryMaster master = new CategoryMaster();
                master.Id            = category.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = category.Name;
                master.Discount      = category.Discount;
                master.Description   = category.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.UpdateCategory(master);
                    return(Content("<script language='javascript' type='text/javascript'>alert('Category Created successfully!');</script>"));
                }
                catch (Exception ex)
                {
                    return(Content("<script language='javascript' type='text/javascript'>alert('Error in category creation!');</script>"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Error in category creation!');</script>"));
            }



            return(Json(res));
        }
        public ActionResult Updatepermission(Permissionviewmodel vm)
        {
            List <string>           result  = new List <string>();
            PermissionMaster        _master = new PermissionMaster();
            List <ModulePermission> p       = new List <ModulePermission>();
            Guid CompanyId = new Guid();

            if (Request.Cookies["CompanyId"] != null)
            {
                CompanyId = new Guid(Commonhelper.GetCookie("CompanyId"));
            }
            Permissionviewmodel searchmodel = new Permissionviewmodel();

            if (vm.PermissionMaster != null)
            {
                _master.Id           = vm.Id;
                _master.CompanyId    = CompanyId.ToString();
                _master.UserId       = vm.UserId;
                _master.ModifiedBy   = User.Identity.GetUserId();
                _master.Datemodified = 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 = Commonhelper.GetSubmenuOrder(mp.SubMenuId);
                            mp.Displayclass = child.Displayclass;
                            mp.DisplayName  = child.DisplayName;
                            _master._ModulePermission.Add(mp);
                        }
                    }
                }
                try
                {
                    Commonhelper.UpdatePermission(_master);
                    return(RedirectToAction("RegisteredAccounts"));
                    ////return Content("<script language='javascript' type='text/javascript'>alert('permission update successfully!');</script>");
                }
                catch (Exception ex)
                {
                }
            }
            //List<Permission> permissions = new List<Permission>();
            //List<ModulePermission> _MPermission = new List<ModulePermission>();
            //try
            //{
            //    if(pm!=null)
            //    {
            //        pm.Datemodified = DateTime.Now;
            //        pm.ModifiedBy = User.Identity.GetUserId();
            //        if (pm._Permission.Count() > 0)
            //        {
            //            foreach(var item in pm._Permission)
            //            {
            //                Permission p = new Permission();
            //                p.DisplayOrder = item.DisplayOrder;
            //                p.Id = Guid.NewGuid();
            //                p.Isactive = item.Isactive;
            //                p.MenuId = item.MenuId;
            //                p.PermissionMasterId = pm.Id;
            //                p.Displayclass = item.Displayclass;
            //                p.DisplayName = item.DisplayName;
            //                permissions.Add(p);

            //            }
            //            pm._Permission.Clear();
            //            pm._Permission = permissions;
            //            foreach(var child in pm._ModulePermission)
            //            {
            //                ModulePermission mp = new ModulePermission();
            //                mp.Id = Guid.NewGuid();
            //                mp.PermissionMasterId = pm.Id;
            //                mp.MenuId = child.MenuId;
            //                mp.SubMenuId = child.SubMenuId;
            //                mp.IsAdd = child.IsAdd;
            //                mp.IsEdit = child.IsEdit;
            //                mp.Isview = child.Isview;
            //                mp.Isdelete = child.Isdelete;
            //                mp.DisplayOrder = child.DisplayOrder;
            //                mp.Displayclass = child.Displayclass;
            //                mp.DisplayName = child.DisplayName;
            //                _MPermission.Add(mp);
            //            }
            //            pm._ModulePermission.Clear();
            //            pm._ModulePermission.AddRange(_MPermission);
            //            try
            //            {
            //                Commonhelper.SavePermission(_master);
            //                /// Commonhelper.UpdatePermission(pm);
            //            }
            //            catch(Exception ex)
            //            {
            //                result.Add("Internal server Issue try again.");
            //            }
            //        }

            //    }
            //    return Content("<script language='javascript' type='text/javascript'>alert('permission update successfully!');</script>");
            //    //result.Add("permission update successfully.");
            //    //ModelState.Clear();
            //    //return Json(new { url = Url.Action("UserLevelPermission") });

            //}
            //catch(Exception ex)
            //{
            //    result.Add("Internal server Issue try again.");

            //}


            return(Json(result));
        }
Exemplo n.º 9
0
        public ActionResult CreateItem(ItemMaster item)
        {
            List <string> res         = new List <string>();
            ItemMaster    _ItemMaster = new ItemMaster();

            try
            {
                if (ModelState.IsValid)
                {
                    var currentuser = Commonhelper.GetCurrentUserDetails();
                    _ItemMaster.StoreId     = currentuser.StoreId;
                    _ItemMaster.CompanyId   = currentuser.CompanyId;
                    _ItemMaster.Description = item.Description;
                    _ItemMaster.ProductCode = item.ProductCode;
                    _ItemMaster.BarCode     = item.BarCode;
                    _ItemMaster.SkuCode     = item.SkuCode;
                    _ItemMaster.SapCode     = item.SapCode;
                    _ItemMaster.Category    = item.Category;
                    _ItemMaster.Color       = item.Color;
                    _ItemMaster.SubCategory = item.SubCategory;

                    _ItemMaster.ProductName  = item.ProductName;
                    _ItemMaster.Brand        = item.Brand;
                    _ItemMaster.Size         = item.Size;
                    _ItemMaster.Quality      = item.Quality;
                    _ItemMaster.Gst          = item.Gst;
                    _ItemMaster.Reorderlevel = item.Reorderlevel;
                    _ItemMaster.Mrp          = item.Mrp;

                    _ItemMaster.Costprice       = item.Costprice;
                    _ItemMaster.Sellprice       = item.Sellprice;
                    _ItemMaster.offer           = item.offer;
                    _ItemMaster.FinancialYear   = item.FinancialYear;
                    _ItemMaster.workstation     = Commonhelper.GetStation();
                    _ItemMaster.HsnCode         = item.HsnCode;
                    _ItemMaster.MaximumQuantity = item.MaximumQuantity;


                    _ItemMaster.MinimumQuantity = item.MinimumQuantity;
                    _ItemMaster.BoxQuantity     = item.BoxQuantity;
                    _ItemMaster.IsUnique        = item.IsUnique;
                    _ItemMaster.Mou             = item.Mou;
                    _ItemMaster.SubMou          = item.SubMou;
                    _ItemMaster.ItemOrder       = item.ItemOrder;
                    _ItemMaster.CreatedDate     = DateTime.Now;
                    _ItemMaster.CreatedBy       = currentuser.Id;
                    _ItemMaster.Isactive        = true;
                    if (item.ItemOptionalDetails.Count() > 0)
                    {
                        foreach (var _item in item.ItemOptionalDetails)
                        {
                            ItemOptionalDetails option = new ItemOptionalDetails();
                            option.Id            = Guid.NewGuid().ToString();
                            option.ItemId        = _ItemMaster.Id;
                            option.OptionalId    = _item.OptionalId;
                            option.OptionalValue = _item.OptionalValue;
                            _ItemMaster.ItemOptionalDetails.Add(option);
                        }
                    }
                    Commonhelper.SaveItem(_ItemMaster);
                    return(Content("<script language='javascript' type='text/javascript'>alert('Item Created successfully!');</script>"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Exemplo n.º 10
0
        public async System.Threading.Tasks.Task <ActionResult> UpdateItem(ItemMaster item)
        {
            ItemMaster _ItemMaster = new ItemMaster();
            bool       status      = false;
            string     msg         = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var currentuser = Commonhelper.GetCurrentUserDetails();
                    _ItemMaster.Id          = item.Id;
                    _ItemMaster.StoreId     = currentuser.StoreId;
                    _ItemMaster.CompanyId   = currentuser.CompanyId;
                    _ItemMaster.Description = item.Description;
                    _ItemMaster.ProductCode = item.ProductCode;
                    _ItemMaster.BarCode     = item.BarCode;
                    _ItemMaster.SkuCode     = item.SkuCode;
                    _ItemMaster.SapCode     = item.SapCode;
                    _ItemMaster.Category    = item.Category;
                    _ItemMaster.Color       = item.Color;
                    _ItemMaster.SubCategory = item.SubCategory;

                    _ItemMaster.ProductName  = item.ProductName;
                    _ItemMaster.Brand        = item.Brand;
                    _ItemMaster.Size         = item.Size;
                    _ItemMaster.Quality      = item.Quality;
                    _ItemMaster.Gst          = item.Gst;
                    _ItemMaster.Reorderlevel = item.Reorderlevel;
                    _ItemMaster.Mrp          = item.Mrp;

                    _ItemMaster.Costprice       = item.Costprice;
                    _ItemMaster.Sellprice       = item.Sellprice;
                    _ItemMaster.offer           = item.offer;
                    _ItemMaster.FinancialYear   = item.FinancialYear;
                    _ItemMaster.workstation     = Commonhelper.GetStation();
                    _ItemMaster.HsnCode         = item.HsnCode;
                    _ItemMaster.MaximumQuantity = item.MaximumQuantity;


                    _ItemMaster.MinimumQuantity = item.MinimumQuantity;
                    _ItemMaster.BoxQuantity     = item.BoxQuantity;
                    _ItemMaster.IsUnique        = item.IsUnique;
                    _ItemMaster.Mou             = item.Mou;
                    _ItemMaster.SubMou          = item.SubMou;
                    _ItemMaster.ItemOrder       = item.ItemOrder;
                    _ItemMaster.ModifiedDate    = DateTime.Now;
                    _ItemMaster.ModifiedBy      = currentuser.Id;
                    if (item.ItemOptionalDetails.Count() > 0)
                    {
                        foreach (var _item in item.ItemOptionalDetails)
                        {
                            ItemOptionalDetails option = new ItemOptionalDetails();
                            option.Id            = Guid.NewGuid().ToString();
                            option.ItemId        = _ItemMaster.Id;
                            option.OptionalId    = _item.OptionalId;
                            option.OptionalValue = _item.OptionalValue;
                            _ItemMaster.ItemOptionalDetails.Add(option);
                        }
                    }
                    try
                    {
                        Commonhelper.UpdateItem(_ItemMaster);
                        status = true;
                        msg    = "Item Updated successfully!";
                        return(Json(new{ status, msg }, JsonRequestBehavior.AllowGet));
                    }
                    catch (Exception ex)
                    {
                        msg    = "Error in processing";
                        status = false;
                        return(Json(new { status, msg }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }