예제 #1
0
        public bool EditCompany(SA_Company News)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Company EditNews = _context.SA_Company.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.Address               = News.Address;
            EditNews.Category              = News.Category;
            EditNews.CEO                   = News.CEO;
            EditNews.CIN                   = News.CIN;
            EditNews.Meta                  = News.Meta;
            EditNews.MetaDescription       = News.MetaDescription;
            EditNews.Description           = News.Description;
            EditNews.Logo                  = News.Logo;
            EditNews.Name                  = News.Name;
            EditNews.NOE                   = News.NOE;
            EditNews.phoneNo               = News.phoneNo;
            EditNews.website               = News.website;
            EditNews.EmailId               = News.EmailId;
            EditNews.fax                   = News.fax;
            EditNews.RegDate               = News.RegDate;
            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #2
0
        public async Task <bool> UpdateUser(SA_User User)
        {
            try
            {
                //  Category.CreatedDate = DateTime.Now;
                SA_User Objuser = _context.SA_User.Where(user => user.id == User.id).FirstOrDefault();
                Objuser.Fname        = User.Fname;
                Objuser.Lname        = User.Lname;
                Objuser.Phone        = User.Phone;
                Objuser.Role         = User.Role;
                Objuser.Email        = User.Email;
                Objuser.Gender       = User.Gender;
                Objuser.UserPassword = User.UserPassword;
                if (User.ProfileImage != null)
                {
                    Objuser.ProfileImage = User.ProfileImage;
                }
                //if (Objuser.ProfileImage != null)
                //    Objuser.ProfileImage = User.ProfileImage;
                _context.Entry(Objuser).State = EntityState.Modified;
                int x = _context.SaveChanges();
                return(x == 0 ? false : true);
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }
예제 #3
0
        public bool EditJob(SA_Job News)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Job EditNews = _context.SA_Job.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.JobName               = News.JobName;
            EditNews.JobDiscription        = News.JobDiscription;
            EditNews.Meta                  = News.Meta;
            EditNews.MetaDiscription       = News.MetaDiscription;
            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #4
0
        public bool EditChemContent(SA_ChemContent News)
        {
            SA_ChemContent EditNews = _context.SA_ChemContent.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.Title       = News.Title;
            EditNews.Description = News.Description;



            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #5
0
        public bool EditSlider(SA_Slider News)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Slider EditNews = _context.SA_Slider.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.Title                 = News.Title;
            EditNews.Category              = News.Category;
            EditNews.Discription           = News.Discription;
            EditNews.Meta                  = News.Meta;
            EditNews.MetaDiscription       = News.MetaDiscription;
            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #6
0
        public ActionResult Deletecountry(int id)
        {
            try
            {
                SA_Country country = _context.SA_Country.Where(c => c.id == id).FirstOrDefault();
                _context.Entry(country).State = EntityState.Deleted;
                int x = _context.SaveChanges();

                return(RedirectToAction("ShowCountryList"));
            }
            catch (Exception ex)
            {
                return(View("ErrorEventArgs"));
            }
        }
예제 #7
0
        public bool EditCMS(SA_CMS CMS)
        {
            //  CMS.CreatedDate = DateTime.Now;
            SA_CMS EditCMS = _context.SA_CMS.Where(Cat => Cat.id == CMS.id).FirstOrDefault();

            EditCMS.CMSName               = CMS.CMSName;
            EditCMS.CMSDiscription        = CMS.CMSDiscription;
            EditCMS.Meta                  = CMS.Meta;
            EditCMS.MetaDiscription       = CMS.MetaDiscription;
            EditCMS.Product               = CMS.Product;
            _context.Entry(EditCMS).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #8
0
 public void AddLeadDetails(Lead_Master Lead)
 {
     _context.Entry(Lead).State = EntityState.Modified;
     //  Role.ModeifiedDate = DateTime.Now;
     int x = _context.SaveChanges();
     // return x == 0 ? false : true;
 }
예제 #9
0
        public async Task <bool> UpdateUser(SA_User User)
        {
            _context.Entry(User).State = EntityState.Modified;
            //  User.ModeifiedDate = DateTime.Now;
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
예제 #10
0
        public bool EditCommentary(SA_Commentary News)
        {
            SA_Commentary EditNews = _context.SA_Commentary.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.Title           = News.Title;
            EditNews.Description     = News.Description;
            EditNews.Meta            = News.Meta;
            EditNews.MetaDescription = News.MetaDescription;
            EditNews.IsActive        = News.IsActive;
            EditNews.IsDelete        = News.IsDelete;
            EditNews.Product         = News.Product;
            EditNews.ImgPath         = News.ImgPath;
            EditNews.CreatedTime     = News.CreatedTime;

            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #11
0
        public bool EditCategory(SA_Category Category)
        {
            //  Category.CreatedDate = DateTime.Now;
            SA_Category EditCategory = _context.SA_Category.Where(Cat => Cat.id == Category.id).FirstOrDefault();

            EditCategory.CategoryName        = Category.CategoryName;
            EditCategory.CategoryDiscription = Category.CategoryDiscription;
            EditCategory.Meta            = Category.Meta;
            EditCategory.MetaDiscription = Category.MetaDiscription;
            //EditCategory.Product = Category.Product;
            if (Category.CategoryImg != null)
            {
                EditCategory.CategoryImg = Category.CategoryImg;
            }
            _context.Entry(EditCategory).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #12
0
        public bool EditProduct(SA_Product Product)
        {
            //  Product.CreatedDate = DateTime.Now;
            SA_Product EditProduct = _context.SA_Product.Where(Cat => Cat.id == Product.id).FirstOrDefault();

            EditProduct.ProductName        = Product.ProductName;
            EditProduct.ProductDiscription = Product.ProductDiscription;
            EditProduct.Meta            = Product.Meta;
            EditProduct.MetaDiscription = Product.MetaDiscription;
            EditProduct.Category        = Product.Category;
            if (Product.ProductImg != null)
            {
                EditProduct.ProductImg = Product.ProductName;
            }
            _context.Entry(EditProduct).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #13
0
        public bool EditDeals(SA_Deals Deals)
        {
            //  Deals.CreatedDate = DateTime.Now;
            SA_Deals EditDeals = _context.SA_Deals.Where(Cat => Cat.id == Deals.id).FirstOrDefault();

            EditDeals.DealsName        = Deals.DealsName;
            EditDeals.DealsDiscription = Deals.DealsDiscription;
            EditDeals.URL             = Deals.URL;
            EditDeals.MetaDiscription = Deals.MetaDiscription;
            EditDeals.MetaTitle       = Deals.MetaTitle;
            EditDeals.Keywords        = Deals.Keywords;
            EditDeals.Product         = Deals.Product;
            EditDeals.CreatedTime     = Deals.CreatedTime;
            if (Deals.DealsImg != null)
            {
                EditDeals.DealsImg = Deals.DealsImg;
            }
            _context.Entry(EditDeals).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #14
0
        public bool EditIndustry(SA_Industry News)
        {
            SA_Industry EditNews = _context.SA_Industry.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.Title                 = News.Title;
            EditNews.Description           = News.Description;
            EditNews.Meta                  = News.Meta;
            EditNews.MetaDescription       = News.MetaDescription;
            EditNews.Figot                 = News.Figot;
            EditNews.Industry              = News.Industry;
            EditNews.format                = News.format;
            EditNews.Pages                 = News.Pages;
            EditNews.RelatedRep            = News.RelatedRep;
            EditNews.Tableoc               = News.Tableoc;
            EditNews.Product               = News.Product;
            EditNews.CategoryID            = News.CategoryID;
            EditNews.CountryID             = News.CountryID;
            EditNews.CreatedTime           = News.CreatedTime;
            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
예제 #15
0
        public ActionResult Delete(int?id)
        {
            ChemAnalystContext _context = new ChemAnalystContext();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SA_Company state = _context.SA_Company.Where(c => c.id == id).FirstOrDefault();

            _context.Entry(state).State = EntityState.Deleted;
            int x = _context.SaveChanges();


            return(RedirectToAction("AllCompanyProf"));
        }
예제 #16
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"));
        }
예제 #17
0
        public bool EditRole(SA_RoleViewModel RoleViewModel)
        {
            //  Role.CreatedDate = DateTime.Now;
            SA_Role Role = _context.SA_Role.Where(role => role.id == RoleViewModel.id).FirstOrDefault();

            Role.RoleDiscription       = RoleViewModel.RoleDiscription;
            Role.Role                  = RoleViewModel.Role;
            _context.Entry(Role).State = EntityState.Modified;

            int x = _context.SaveChanges();
            List <SA_RoleWiseAccess> Editrole = _context.SA_RoleWiseAccess.Where(role => role.RoleId == RoleViewModel.id).ToList();

            foreach (var item in Editrole)
            {
                _context.Entry(item).State = EntityState.Deleted;
                _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);
                _context.SaveChanges();
            }
            return(x == 0 ? false : true);
        }
예제 #18
0
        internal int CheckExistingdata(string Filename, string ImportType)
        {
            int x = 0;

            if (ImportType == "Yearly")
            {
                List <SA_ChemPriceYearly> obj = _context.SA_ChemPriceYearly.Where(Year => Year.FileName == Filename).ToList();
                foreach (SA_ChemPriceYearly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Monthly")
            {
                List <SA_ChemPriceMonthly> obj = _context.SA_ChemPriceMonthly.Where(Year => Year.FileName == Filename).ToList();
                foreach (SA_ChemPriceMonthly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Quarterly")
            {
                List <SA_ChemPriceQuarterly> obj = _context.SA_ChemPriceQuarterly.Where(Year => Year.FileName == Filename).ToList();
                foreach (SA_ChemPriceQuarterly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Daily basis")
            {
                List <SA_ChemPriceDaily> obj = _context.SA_ChemPriceDaily.Where(Year => Year.FileName == Filename).ToList();
                foreach (SA_ChemPriceDaily PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Daily Bulk")
            {
                List <SA_ChemPriceDailyAverage> obj = _context.SA_ChemPriceDailyAverage.Where(Year => Year.FileName == Filename).ToList();
                foreach (SA_ChemPriceDailyAverage PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Chemical 1")
            {
                List <SA_Chem1PriceWeekly> obj = _context.SA_Chem1PriceWeekly.ToList();
                foreach (SA_Chem1PriceWeekly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Chemical 2")
            {
                List <SA_Chem2PriceWeekly> obj = _context.SA_Chem2PriceWeekly.ToList();
                foreach (SA_Chem2PriceWeekly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Chemical 3")
            {
                List <SA_Chem3PriceWeekly> obj = _context.SA_Chem3PriceWeekly.ToList();
                foreach (SA_Chem3PriceWeekly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Chemical 4")
            {
                List <SA_Chem4PriceWeekly> obj = _context.SA_Chem4PriceWeekly.ToList();
                foreach (SA_Chem4PriceWeekly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Chemical 5")
            {
                List <SA_Chem5PriceWeekly> obj = _context.SA_Chem5PriceWeekly.ToList();
                foreach (SA_Chem5PriceWeekly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }
            else if (ImportType == "Chemical 6")
            {
                List <SA_Chem6PriceWeekly> obj = _context.SA_Chem6PriceWeekly.ToList();
                foreach (SA_Chem6PriceWeekly PriceYearly in obj)
                {
                    _context.Entry(PriceYearly).State = EntityState.Deleted;
                    x = _context.SaveChanges();
                }
            }



            return(x);
        }