Ejemplo n.º 1
0
        public async Task <bool> AddJob(SA_Job News)
        {
            //  News.CreatedDate = DateTime.Now;
            _context.SA_Job.Add(News);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 2
0
        public async Task <bool> AddCMS(SA_CMS CMS)
        {
            //  CMS.CreatedDate = DateTime.Now;
            _context.SA_CMS.Add(CMS);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 3
0
        public async Task <bool> AddAdvisoryConetnt(SA_AdvisoryContent News)
        {
            News.CreatedTime = DateTime.Now;
            _context.SA_AdvisoryContent.Add(News);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 4
0
        public async Task <bool> AddUser(SA_User User)
        {
            //  User.CreatedDate = DateTime.Now;
            _context.SA_User.Add(User);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 5
0
        public async Task <bool> AddCategory(SA_Category Category)
        {
            //  Category.CreatedDate = DateTime.Now;
            _context.SA_Category.Add(Category);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 6
0
        public async Task <bool> AddProduct(SA_Product Product)
        {
            //  Product.CreatedDate = DateTime.Now;
            _context.SA_Product.Add(Product);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 7
0
        public async Task <bool> AddIndustry(SA_Industry News)
        {
            News.CreatedTime = News.CreatedTime != null? News.CreatedTime.Value: DateTime.Now;

            _context.SA_Industry.Add(News);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 8
0
        public async Task <bool> AddCommentary(SA_Commentary News)
        {
            News.IsActive    = true;
            News.IsDelete    = false;
            News.CreatedTime = News.CreatedTime != null? News.CreatedTime: DateTime.Now;

            _context.SA_Commentary.Add(News);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 9
0
        public async Task <bool> UpdateDeals(SA_Deals Deals)
        {
            _context.Entry(Deals).State = EntityState.Modified;
            //  Deals.ModeifiedDate = DateTime.Now;
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Ejemplo n.º 10
0
        public async Task <bool> AddFreeTrial(Lead_Master lead)
        {
            int x = 0;

            try
            {
                _context.Lead_Master.Add(lead);
                x = await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
            }
            return(x == 0 ? false : true);
        }
Ejemplo n.º 11
0
        public async Task <bool> AddSalesPackageTrial(SalesPackageSubscription subs)
        {
            int x = 0;

            try
            {
                subs.Status = "Active";
                _context.SalesPackageSubscription.Add(subs);
                x = await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
            }
            return(x == 0 ? false : true);
        }
Ejemplo n.º 12
0
        public ActionResult SaveHeaderContent(SA_HomeHeader UserNews)
        {
            if (UserNews.Id == 0)
            {
                UserNews.CreatedTime = DateTime.Now;
                _context.SA_HomeHeader.Add(UserNews);
                _context.SaveChangesAsync();
            }
            else
            {
                SA_HomeHeader EditNews = _context.SA_HomeHeader.Where(Cat => Cat.Id == UserNews.Id).FirstOrDefault();
                EditNews.EmailAddress  = UserNews.EmailAddress;
                EditNews.OfficeAddress = UserNews.OfficeAddress;
                EditNews.PhoneNumber   = UserNews.PhoneNumber;

                EditNews.CreatedTime           = UserNews.CreatedTime;
                _context.Entry(EditNews).State = EntityState.Modified;
                int x = _context.SaveChanges();
            }
            return(RedirectToAction("HeaderContent"));
        }
Ejemplo n.º 13
0
        public async Task <bool> AddRole(SA_RoleViewModel RoleViewModel)
        {
            try
            {
                int     x    = 0;
                SA_Role Role = new Models.SA_Role();
                Role.Role            = RoleViewModel.Role;
                Role.CreatedTime     = DateTime.Now;
                Role.RoleDiscription = RoleViewModel.RoleDiscription;
                _context.SA_Role.Add(Role);
                _context.SaveChanges();



                if (RoleViewModel.ChemicalPricing == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 1;
                    access.access          = true;
                    access.PageDiscription = "Chemical Pricing";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    _context.SaveChanges();
                }
                if (RoleViewModel.MarketAnalysis == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 2;
                    access.access          = true;
                    access.PageDiscription = "Market Analysis";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    _context.SaveChanges();
                }
                if (RoleViewModel.CompanyProfile == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 3;
                    access.access          = true;
                    access.PageDiscription = "Company Profile";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    _context.SaveChanges();
                }
                if (RoleViewModel.IndustryReports == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 4;
                    access.access          = true;
                    access.PageDiscription = "Industry Reports";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    _context.SaveChanges();
                }
                if (RoleViewModel.News == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 5;
                    access.access          = true;
                    access.PageDiscription = "News";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    _context.SaveChanges();
                }
                if (RoleViewModel.Deals == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 6;
                    access.access          = true;
                    access.PageDiscription = "Deals";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    _context.SaveChanges();
                }
                if (RoleViewModel.SubscriptionManagement == true)
                {
                    SA_RoleWiseAccess access = new Models.SA_RoleWiseAccess();
                    access.RoleId          = Role.id;
                    access.Pageid          = 7;
                    access.access          = true;
                    access.PageDiscription = "Subscription Management";
                    access.CreatedTime     = DateTime.Now;
                    _context.SA_RoleWiseAccess.Add(access);
                    x = await _context.SaveChangesAsync();
                }
                return(x == 0 ? false : true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 14
0
        public async Task <bool> AddCustWiseAccess(string id, int Custid)
        {
            try
            {
                int x = 0;

                string[] items = id.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var i in items)
                {
                    if (Convert.ToInt32(i) == 1)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 1;
                        access.access          = true;
                        access.PageDiscription = "Chemical Pricing";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = _context.SaveChanges();
                    }
                    if (Convert.ToInt32(i) == 2)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 2;
                        access.access          = true;
                        access.PageDiscription = "Market Analysis";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = _context.SaveChanges();
                    }
                    if (Convert.ToInt32(i) == 3)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 3;
                        access.access          = true;
                        access.PageDiscription = "Company Profile";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = _context.SaveChanges();
                    }
                    if (Convert.ToInt32(i) == 4)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 4;
                        access.access          = true;
                        access.PageDiscription = "Industry Reports";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = _context.SaveChanges();
                    }
                    if (Convert.ToInt32(i) == 5)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 5;
                        access.access          = true;
                        access.PageDiscription = "News";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = _context.SaveChanges();
                    }
                    if (Convert.ToInt32(i) == 6)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 6;
                        access.access          = true;
                        access.PageDiscription = "Deals";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = _context.SaveChanges();
                    }
                    if (Convert.ToInt32(i) == 7)
                    {
                        CustWiseAccess access = new Models.CustWiseAccess();
                        access.CustId          = Custid;
                        access.Pageid          = 7;
                        access.access          = true;
                        access.PageDiscription = "Subscription Management";
                        access.CreatedTime     = DateTime.Now;
                        _context.CustWiseAccess.Add(access);
                        x = await _context.SaveChangesAsync();
                    }
                }
                return(x == 0 ? false : true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }