예제 #1
0
        // GET: Clients/Contact
        public ActionResult Index()
        {
            CMS_CompanyModels model = new CMS_CompanyModels();

            model = _facComInfo.GetInfor();
            return(View(model));
        }
예제 #2
0
 public ProductViewModels()
 {
     ListCate    = new List <CMSCategoriesModels>();
     ListProduct = new List <CMS_ProductsModels>();
     Company     = new CMS_CompanyModels();
     ListNews    = new List <CMS_NewsModels>();
 }
예제 #3
0
 public CMS_NewsViewModel()
 {
     ListNews     = new List <CMS_NewsModels>();
     ListNewsNew  = new List <CMS_NewsModels>();
     CMS_News     = new CMS_NewsModels();
     ListCate     = new List <CMSCategoriesModels>();
     ListProduct  = new List <CMS_ProductsModels>();
     CompanyInfor = new CMS_CompanyModels();
 }
예제 #4
0
 public ProductViewModels()
 {
     ListCate       = new List <CMSCategoriesModels>();
     ListProduct    = new List <CMS_ProductsModels>();
     Company        = new CMS_CompanyModels();
     ListNews       = new List <CMS_NewsModels>();
     ListEmployee   = new List <CMS_EmployeeModels>();
     ListProcedures = new List <CMS_ProceduresModels>()
     {
     };
     LstDiscount = new List <CMS_DiscountModels>();
 }
예제 #5
0
        public CMS_CompanyModels GetInfor()
        {
            NSLog.Logger.Info("CompGetInfor");

            CMS_CompanyModels result = null;

            try
            {
                using (var cxt = new CMS_Context())
                {
                    var data = cxt.CMS_Companies.Select(x => new CMS_CompanyModels
                    {
                        ID            = x.Id,
                        Name          = x.Name,
                        Description   = x.Description,
                        Email         = x.Email,
                        Phone         = x.Phone,
                        Address       = x.Address,
                        LinkBlog      = x.LinkBlog,
                        LinkTwiter    = x.LinkTwiter,
                        LinkInstagram = x.LinkInstagram,
                        LinkFB        = x.LinkFB,
                        ImageURL      = string.IsNullOrEmpty(x.ImageURL) ? "" : Commons.HostImage + x.ImageURL,
                        IsActive      = true,
                        CreatedBy     = x.CreatedBy,
                        CreatedDate   = DateTime.Now,
                        UpdatedBy     = x.UpdatedBy,
                        UpdatedDate   = DateTime.Now
                    }).FirstOrDefault();

                    result = data;

                    NSLog.Logger.Info("ResponseCompGetInfor", new { result });
                }
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("ErrorCompGetInfor", ex);
            }
            return(result);
        }
예제 #6
0
        public bool CreateOrUpdate(CMS_CompanyModels model, ref string msg)
        {
            var result = true;

            using (var cxt = new CMS_Context())
            {
                using (var trans = cxt.Database.BeginTransaction())
                {
                    try
                    {
                        if (string.IsNullOrEmpty(model.ID))
                        {
                            var e = new CMS_Companies
                            {
                                Id            = Guid.NewGuid().ToString(),
                                Name          = model.Name,
                                Description   = model.Description,
                                Email         = model.Email,
                                Phone         = model.Phone,
                                Address       = model.Address,
                                LinkBlog      = model.LinkBlog,
                                LinkTwiter    = model.LinkTwiter,
                                LinkInstagram = model.LinkInstagram,
                                LinkFB        = model.LinkFB,
                                ImageURL      = model.ImageURL,
                                IsActive      = true,
                                BusinessHour  = model.Businesshour,
                                CreatedBy     = model.CreatedBy,
                                CreatedDate   = DateTime.Now,
                                UpdatedBy     = model.UpdatedBy,
                                UpdatedDate   = DateTime.Now
                            };
                            cxt.CMS_Companies.Add(e);
                        }
                        else
                        {
                            var e = cxt.CMS_Companies.Find(model.ID);
                            if (e != null)
                            {
                                e.Name          = model.Name;
                                e.Description   = model.Description;
                                e.Email         = model.Email;
                                e.Phone         = model.Phone;
                                e.Address       = model.Address;
                                e.LinkBlog      = model.LinkBlog;
                                e.LinkTwiter    = model.LinkTwiter;
                                e.LinkInstagram = model.LinkInstagram;
                                e.LinkFB        = model.LinkFB;
                                //e.ImageURL = model.ImageURL;
                                e.IsActive     = true;
                                e.BusinessHour = model.Businesshour;
                                e.UpdatedBy    = model.UpdatedBy;
                                e.UpdatedDate  = DateTime.Now;
                            }
                            if (!string.IsNullOrEmpty(model.ImageURL))
                            {
                                e.ImageURL = model.ImageURL;
                            }
                        }
                        cxt.SaveChanges();
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        result = false;
                        trans.Rollback();
                        msg = "Lỗi đường truyền mạng";
                    }
                    finally
                    {
                        cxt.Dispose();
                    }
                }
            }
            return(result);
        }
예제 #7
0
 public CMSHomeModels()
 {
     Silder  = new SilderModels();
     ComInfo = new CMS_CompanyModels();
 }