Ejemplo n.º 1
0
 public JsonResult IsUserExist(string User)
 {
     using (MABRUKLISTEntities dbContext = new MABRUKLISTEntities())
     {
         return(Json(!dbContext.AspNetUsers.Any(x => x.UserName == User), JsonRequestBehavior.AllowGet));
     };
 }
Ejemplo n.º 2
0
 public JsonResult IsEmailExist(string Email)
 {
     using (MABRUKLISTEntities dbContext = new MABRUKLISTEntities())
     {
         return(Json(!dbContext.AspNetUsers.Any(x => x.Email == Email), JsonRequestBehavior.AllowGet));
     };
 }
 public ActionResult GetCongregation(int id)
 {
     try
     {
         CongregationDTO congr = new CongregationDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var con = dbcontext.mblist_congregation.Find(id);
             if (con != null)
             {
                 congr.id           = con.congregation_key;
                 congr.congregation = con.congregation_name;
                 return(PartialView("_AddCongregation", congr));
             }
             else
             {
                 return(Json(new { key = false, value = "Congregation not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the address" }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult GetCategory(int id)
 {
     try
     {
         CategoryDto category = new CategoryDto();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var cat = dbcontext.mblist_category.Find(id);
             if (cat != null)
             {
                 category.Id       = cat.cat_key;
                 category.Category = cat.cat_name;
                 return(PartialView("AddCategory", category));
             }
             else
             {
                 return(Json(new { key = false, value = "Category not found its deleted" }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the category" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 5
0
        public ActionResult AddContact()
        {
            using (MABRUKLISTEntities dbcontaxt = new MABRUKLISTEntities())
            {
                //Group
                ViewBag.groups = dbcontaxt.mblist_group.AsEnumerable().Select(x => new SelectListItem
                {
                    Value = x.group_key.ToString(),
                    Text  = x.group_name.ToString()
                }).ToList();

                //Congregation
                ViewBag.congregations = dbcontaxt.mblist_congregation.AsEnumerable().Select(x => new SelectListItem
                {
                    Value = x.congregation_key.ToString(),
                    Text  = x.congregation_name
                }).ToList();

                //Nieghbourhood
                ViewBag.nieghbourhood = dbcontaxt.mblist_neighborhoods.AsEnumerable().Select(x => new SelectListItem
                {
                    Value = x.neighborhoods_key.ToString(),
                    Text  = x.neighborhoods_name
                }).ToList();
            };
            return(PartialView("_AddContact"));
        }
Ejemplo n.º 6
0
        public ActionResult DeleteUser(int id)
        {
            try
            {
                using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
                {
                    var user = dbcontext.mblist_user_info.Find(id);

                    if (user != null)
                    {
                        var aspuser = dbcontext.AspNetUsers.Find(user.usr_aspnet_user);
                        dbcontext.mblist_user_info.Remove(user);
                        dbcontext.SaveChanges();
                        if (aspuser != null)
                        {
                            dbcontext.AspNetUsers.Remove(aspuser);
                            dbcontext.SaveChanges();
                        }
                        return(Json(new { key = true, value = "user deleted successfully" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { key = false, value = "user not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(new { key = false, value = "Unable to edit the User" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 7
0
 public ActionResult GetAddress(int id)
 {
     try
     {
         AddressDTO adrs = new AddressDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var address = dbcontext.mblist_address.Find(id);
             if (address != null)
             {
                 adrs.id      = address.address_key;
                 adrs.Address = address.address_name;
                 return(PartialView("_AddAddress", adrs));
             }
             else
             {
                 return(Json(new { key = false, value = "Address not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the address" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 8
0
 public ActionResult SetTemplateColors(string fontcolor, string subjectcolor, int EventId)
 {
     try
     {
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var events = dbcontext.mblist_events_detail.Find(EventId);
             if (events != null)
             {
                 events.event_font_color    = fontcolor;
                 events.event_subject_color = subjectcolor;
                 dbcontext.SaveChanges();
                 return(Json(new { key = true, value = "Subject and Font colors updated successfully", templateId = events.event_template_Id }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { key = false, value = "Event not found" }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception e)
     {
         return(Json(new { key = false, value = "Unable to process your request.Please contact your admin" }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult GetCategories(int id)
 {
     try
     {
         CategoriesDTO Catgr = new CategoriesDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var cat = dbcontext.mblist_service_category.Find(id);
             if (cat != null)
             {
                 Catgr.id       = cat.Category_key;
                 Catgr.Category = cat.Category_Name;
                 return(PartialView("_AddCategories", Catgr));
             }
             else
             {
                 return(Json(new { key = false, value = "Category not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the Category" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 10
0
        public ActionResult UpdateEvent(int eventkey)
        {
            ViewBag.eventKeys   = eventkey;
            ViewBag.eventStatus = "Update";
            EventDTO evnt = new EventDTO();

            using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
            {
                var events = dbcontext.mblist_events_detail.Find(eventkey);
                if (events != null)
                {
                    evnt.id       = events.event_detail_key;
                    evnt.Category = events.event_detail_category_key;
                    evnt.EventFor = events.event_detail_type_key;
                    evnt.Title    = events.event_detail_title;
                    evnt.Date     = events.event_detail_date.ToString("MM/dd/yyyy hh:mm tt");
                    evnt.Address  = events.event_detail_address;
                    evnt.Comment  = events.event_detail_discription;
                }
                //Category
                evnt.eventCategoryList = dbcontext.mblist_category.AsEnumerable().Select(x => new CategoryDto
                {
                    Id       = x.cat_key,
                    Category = x.cat_name
                }).ToList();

                //Types
                evnt.eventTypesList = dbcontext.mblist_type.AsEnumerable().Select(x => new TypeDto
                {
                    id   = x.type_key,
                    Type = x.type_name
                }).ToList();
            };
            return(View("_AddEvent", evnt));
        }
 public ActionResult GetNeighbourhood(int id)
 {
     try
     {
         NeighbourhoodDTO NBhood = new NeighbourhoodDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var NeighbourHD = dbcontext.mblist_neighborhoods.Find(id);
             if (NeighbourHD != null)
             {
                 NBhood.id            = NeighbourHD.neighborhoods_key;
                 NBhood.Neighbourhood = NeighbourHD.neighborhoods_name;
                 return(PartialView("_AddNeighbourhood", NBhood));
             }
             else
             {
                 return(Json(new { key = false, value = "Neighbourhood not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the Neighbourhood" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 12
0
 public ActionResult UserDetails(int?group, int?Congregations, int?neighbourhood)
 {
     using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
     {
         var allusers = dbcontext.mblist_user_info.AsEnumerable();
         if (group != null)
         {
             allusers = allusers.Where(x => x.usr_group_key == group);
         }
         if (Congregations != null)
         {
             allusers = allusers.Where(x => x.usr_congregation_key == Congregations);
         }
         if (neighbourhood != null)
         {
             allusers = allusers.Where(x => x.usr_neighbourhood_key == neighbourhood);
         }
         var users = allusers.Select(x => new ContactUsersDto
         {
             Id     = x.usr_key,
             Users  = (x.mblist_title != null ? x.mblist_title.title_name + " " : string.Empty) + (x.usr_first_name + " " + x.usr_last_name),
             Action = "<input class='userscbox' confirmed='false' type='checkbox' value='" + x.AspNetUsers.Id + "'>"
         }).ToList();
         return(Json(users, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 13
0
 public ActionResult GetTitle(int id)
 {
     try
     {
         TitleDTO Title = new TitleDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var title = dbcontext.mblist_title.Find(id);
             if (title != null)
             {
                 Title.id    = title.title_key;
                 Title.Title = title.title_name;
                 return(PartialView("_AddTitle", Title));
             }
             else
             {
                 return(Json(new { key = false, value = "Title not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 14
0
 public ActionResult GetSubtitle(int id)
 {
     try
     {
         SubtitleDTO sbt = new SubtitleDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var SubT = dbcontext.mblist_subtitle.Find(id);
             if (SubT != null)
             {
                 sbt.id       = SubT.subtitle_key;
                 sbt.subtitle = SubT.subtitle_name;
                 return(PartialView("_AddSubtitle", sbt));
             }
             else
             {
                 return(Json(new { key = false, value = "Subtitle not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the Subtitle" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 15
0
 public ActionResult GetGroup(int id)
 {
     try
     {
         GroupDTO Group = new GroupDTO();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var group = dbcontext.mblist_group.Find(id);
             if (group != null)
             {
                 Group.id    = group.group_key;
                 Group.Group = group.group_name;
                 return(PartialView("AddGroup", Group));
             }
             else
             {
                 return(Json(new { key = false, value = "Group not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the Group" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 16
0
 public ActionResult GetType(int id)
 {
     try
     {
         TypeDto Type = new TypeDto();
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var type = dbcontext.mblist_type.Find(id);
             if (type != null)
             {
                 Type.id   = type.type_key;
                 Type.Type = type.type_name;
                 return(PartialView("AddType", Type));
             }
             else
             {
                 return(Json(new { key = false, value = "Type not Found its Deleted from data base!!" }, JsonRequestBehavior.AllowGet));
             }
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to edit the type" }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult DeleteInvitation(int Id)
 {
     try
     {
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var invitation = dbcontext.mblist_invitation_cards.Find(Id);
             if (invitation != null)
             {
                 string path     = invitation.invitation_img_path;
                 string fullPath = Request.MapPath(path);
                 if (System.IO.File.Exists(fullPath))
                 {
                     System.IO.File.Delete(fullPath);
                 }
                 dbcontext.mblist_invitation_cards.Remove(invitation);
                 dbcontext.SaveChanges();
                 return(Json(new { key = true, value = "Invitation Deleted successfully" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { key = false, value = "Invitation not found" }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception ex)
     {
         return(Json(new { key = false, value = "Unable to process your request. Please contact your admin." }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 18
0
 public ActionResult AddOrUpdateEvents(EventDTO dtoEvent)
 {
     try
     {
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             DateTime invitationDate = DateTime.ParseExact(dtoEvent.Date, "MM/dd/yyyy h:mm tt", null);
             //Following line is used to get logged in userid
             string usrkey = User.Identity.GetUserId();
             if (dtoEvent.id != 0)
             {
                 var Data = dbcontext.mblist_events_detail.Find(dtoEvent.id);
                 if (Data != null)
                 {
                     Data.event_detail_category_key = dtoEvent.Category;
                     Data.event_detail_type_key     = dtoEvent.EventFor;
                     Data.event_detail_title        = dtoEvent.Title;
                     Data.event_detail_address      = dtoEvent.Address;
                     Data.event_detail_discription  = dtoEvent.Comment;
                     Data.event_detail_date         = invitationDate;
                     Data.event_detail_user_key     = usrkey;
                     dbcontext.SaveChanges();
                     return(Json(new { key = true, value = "event updated successfully", eventKey = Data.event_detail_key }, JsonRequestBehavior.AllowGet));
                 }
                 else
                 {
                     return(Json(new { key = false, value = "event event not found" }, JsonRequestBehavior.AllowGet));
                 }
             }
             else
             {
                 mblist_events_detail evn = new mblist_events_detail()
                 {
                     event_detail_category_key = dtoEvent.Category,
                     event_detail_type_key     = dtoEvent.EventFor,
                     event_detail_title        = dtoEvent.Title,
                     event_detail_address      = dtoEvent.Address,
                     event_detail_date         = invitationDate,
                     event_detail_discription  = dtoEvent.Comment,
                     event_detail_user_key     = usrkey,
                     event_subject_color       = "brown",
                     event_font_color          = "#000",
                     event_subject             = "You are invited for an event"
                 };
                 dbcontext.mblist_events_detail.Add(evn);
                 dbcontext.SaveChanges();
                 return(Json(new { key = true, value = "event added successfully", eventKey = evn.event_detail_key }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception ex)
     {
         return(Json(new { key = false, value = "Unable to save the event" }, JsonRequestBehavior.AllowGet));;
     }
 }
        public ActionResult UploadInvitations()
        {
            if (Request.Files.Count > 0)
            {
                try
                {
                    string dbfile = "";
                    HttpFileCollectionBase files = Request.Files;
                    for (int i = 0; i < files.Count; i++)
                    {
                        HttpPostedFileBase file  = files[i];
                        string             fname = "";
                        dbfile = "";
                        // Checking for Internet Explorer
                        if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                        {
                            string[] testfiles = file.FileName.Split(new char[] { '\\' });
                            fname = testfiles[testfiles.Length - 1];
                        }
                        else
                        {
                            fname = file.FileName;
                        }

                        var myUniqueFileName = Guid.NewGuid().ToString();
                        fname  = myUniqueFileName + "-" + fname;
                        dbfile = fname;
                        if (!Directory.Exists(Server.MapPath("~/Invitations/")))
                        {
                            Directory.CreateDirectory(Server.MapPath("~/Invitations/"));
                        }
                        fname = Path.Combine(Server.MapPath("~/Invitations/"), fname);
                        file.SaveAs(fname);
                        using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
                        {
                            mblist_invitation_cards card = new mblist_invitation_cards()
                            {
                                invitation_img_path = "/Invitations/" + dbfile
                            };
                            dbcontext.mblist_invitation_cards.Add(card);
                            dbcontext.SaveChanges();
                        };
                    }
                    return(Json(new { key = true, value = "Invitation card saved successfully", path = dbfile }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { key = false, value = "Unable to process your request. Please contact your admin." }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { key = false, value = "No file is selected." }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 20
0
        public ActionResult AddOrUpdateAddress(AddressDTO dto)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
                    {
                        if (dto.id == 0)
                        {
                            var data = dbcontext.mblist_address.Where(x => x.address_name == dto.Address).FirstOrDefault();
                            if (data != null)
                            {
                                return(Json(new { key = false, value = "Address already exist" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                mblist_address obj = new mblist_address()
                                {
                                    address_name = dto.Address
                                };
                                dbcontext.mblist_address.Add(obj);
                                dbcontext.SaveChanges();
                                return(Json(new { key = true, value = "Congregation added successfully" }, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else
                        {
                            var data = dbcontext.mblist_address.Find(dto.id);
                            if (data != null)
                            {
                                data.address_name = dto.Address;
                                dbcontext.SaveChanges();
                                return(Json(new { key = true, value = "Address updated successfully" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                return(Json(new { key = false, value = "Address not found" }, JsonRequestBehavior.AllowGet));
                            }
                        }
                    };
                }
                else
                {
                    return(Json(new { key = false, value = "Please enter correct data" }, JsonRequestBehavior.AllowGet));
                }
            }

            catch (Exception)
            {
                return(Json(new { key = false, value = "Unable to save the Address" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 21
0
        //insertion
        public ActionResult AddOrUpdateType(TypeDto dto)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
                    {
                        if (dto.id == 0)
                        {
                            var data = dbcontext.mblist_type.Where(x => x.type_name == dto.Type).FirstOrDefault();
                            if (data != null)
                            {
                                return(Json(new { key = false, value = "Type already exist" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                mblist_type type = new mblist_type()
                                {
                                    type_name = dto.Type
                                };

                                dbcontext.mblist_type.Add(type);
                                dbcontext.SaveChanges();
                                return(Json(new { key = true, value = "Type added successfully" }, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else
                        {
                            var data = dbcontext.mblist_type.Find(dto.id);
                            if (data != null)
                            {
                                data.type_name = dto.Type;
                                dbcontext.SaveChanges();
                                return(Json(new { key = true, value = "Type Updated Successfully" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                return(Json(new { key = false, value = "Type is not found" }, JsonRequestBehavior.AllowGet));
                            }
                        }
                    };
                }
                else
                {
                    return(Json(new { key = false, value = "Please enter correct data" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                return(Json(new { key = false, value = "Unable to save the Type" }, JsonRequestBehavior.AllowGet));
            }
        }
 public ActionResult AddOrUpdateNeighbourhood(NeighbourhoodDTO dto)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
             {
                 if (dto.id == 0)
                 {
                     var data = dbcontext.mblist_neighborhoods.Where(x => x.neighborhoods_name == dto.Neighbourhood).FirstOrDefault();
                     if (data != null)
                     {
                         return(Json(new { key = false, value = "Neighbourhood already exist" }, JsonRequestBehavior.AllowGet));
                     }
                     else
                     {
                         mblist_neighborhoods nbhood = new mblist_neighborhoods()
                         {
                             neighborhoods_name = dto.Neighbourhood
                         };
                         dbcontext.mblist_neighborhoods.Add(nbhood);
                         dbcontext.SaveChanges();
                         return(Json(new { key = true, value = "Neighbourhood added successfully" }, JsonRequestBehavior.AllowGet));
                     }
                 }
                 else
                 {
                     var data = dbcontext.mblist_neighborhoods.Find(dto.id);
                     if (data != null)
                     {
                         data.neighborhoods_name = dto.Neighbourhood;
                         dbcontext.SaveChanges();
                         return(Json(new { key = true, value = "Neighbourhood updated successfully" }, JsonRequestBehavior.AllowGet));
                     }
                     else
                     {
                         return(Json(new { key = false, value = "Neighbourhood not found" }, JsonRequestBehavior.AllowGet));
                     }
                 }
             };
         }
         else
         {
             return(Json(new { key = false, value = "Please enter correct data" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to save the Neighbourhood" }, JsonRequestBehavior.AllowGet));;
     }
 }
Ejemplo n.º 23
0
 public ActionResult AddOrUpdateGroup(GroupDTO dto)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
             {
                 if (dto.id == 0)
                 {
                     var data = dbcontext.mblist_group.Where(x => x.group_name == dto.Group).FirstOrDefault();
                     if (data != null)
                     {
                         return(Json(new { key = false, value = "Group already exist" }, JsonRequestBehavior.AllowGet));
                     }
                     else
                     {
                         mblist_group group = new mblist_group()
                         {
                             group_name = dto.Group
                         };
                         dbcontext.mblist_group.Add(group);
                         dbcontext.SaveChanges();
                         return(Json(new { key = true, value = "Group added successfully" }, JsonRequestBehavior.AllowGet));
                     }
                 }
                 else
                 {
                     var data = dbcontext.mblist_group.Find(dto.id);
                     if (data != null)
                     {
                         data.group_name = dto.Group;
                         dbcontext.SaveChanges();
                         return(Json(new { key = true, value = "Group Updated Successfully" }, JsonRequestBehavior.AllowGet));
                     }
                     else
                     {
                         return(Json(new { key = false, value = "Group is not found" }, JsonRequestBehavior.AllowGet));
                     }
                 }
             };
         }
         else
         {
             return(Json(new { key = false, value = "Please enter correct data" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to save the Group" }, JsonRequestBehavior.AllowGet));;
     }
 }
 public ActionResult AddOrUpdateCategoreis(CategoriesDTO dto)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
             {
                 if (dto.id == 0)
                 {
                     var data = dbcontext.mblist_service_category.Where(x => x.Category_Name == dto.Category).FirstOrDefault();
                     if (data != null)
                     {
                         return(Json(new { key = false, value = "Group already exist" }, JsonRequestBehavior.AllowGet));
                     }
                     else
                     {
                         mblist_service_category CATtb = new mblist_service_category()
                         {
                             Category_Name = dto.Category
                         };
                         dbcontext.mblist_service_category.Add(CATtb);
                         dbcontext.SaveChanges();
                         return(Json(new { key = true, value = "Category added successfully" }, JsonRequestBehavior.AllowGet));
                     }
                 }
                 else
                 {
                     var data = dbcontext.mblist_service_category.Find(dto.id);
                     if (data != null)
                     {
                         data.Category_Name = dto.Category;
                         dbcontext.SaveChanges();
                         return(Json(new { key = true, value = "Category Updated Successfully" }, JsonRequestBehavior.AllowGet));
                     }
                     else
                     {
                         return(Json(new { key = false, value = "Category is not found" }, JsonRequestBehavior.AllowGet));
                     }
                 }
             };
         }
         else
         {
             return(Json(new { key = false, value = "Please enter correct data" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { key = false, value = "Unable to save the Category" }, JsonRequestBehavior.AllowGet));;
     }
 }
Ejemplo n.º 25
0
 public ActionResult SetColorsModal(int eventId)
 {
     using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
     {
         var eventObj = dbcontext.mblist_events_detail.Find(eventId);
         if (eventObj != null)
         {
             ViewBag.subjectcolor = eventObj.event_subject_color;
             ViewBag.fontcolor    = eventObj.event_font_color;
         }
     };
     return(PartialView("_SetColors"));
 }
        public ActionResult CategoriesListing()
        {
            List <CategoriesDTO> CatList = new List <CategoriesDTO>();

            using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
            {
                CatList = dbcontext.mblist_service_category.AsEnumerable().OrderByDescending(x => x.Category_key).Select(x => new CategoriesDTO
                {
                    id       = x.Category_key,
                    Category = x.Category_Name
                }).ToList();
            };
            return(PartialView("_CategoriesListing", CatList));
        }
Ejemplo n.º 27
0
        //Select
        public ActionResult TypeListing()
        {
            List <TypeDto> TypeList = new List <TypeDto>();

            using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
            {
                TypeList = dbcontext.mblist_type.AsEnumerable().OrderByDescending(x => x.type_key).Select(x => new TypeDto
                {
                    id   = x.type_key,
                    Type = x.type_name
                }).ToList();
            };
            return(PartialView("_TypeListing", TypeList));
        }
Ejemplo n.º 28
0
        public ActionResult TitleListing()
        {
            List <TitleDTO> TitleList = new List <TitleDTO>();

            using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
            {
                TitleList = dbcontext.mblist_title.AsEnumerable().OrderByDescending(x => x.title_key).Select(x => new TitleDTO
                {
                    id    = x.title_key,
                    Title = x.title_name
                }).ToList();
            };
            return(PartialView("_TitleListing", TitleList));
        }
Ejemplo n.º 29
0
        public ActionResult InvitationTemplates()
        {
            List <InvitationDto> inviteList = new List <InvitationDto>();

            using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
            {
                inviteList = dbcontext.mblist_invitation_cards.AsEnumerable().OrderByDescending(x => x.inviation_key).Select(x => new InvitationDto
                {
                    Id   = x.inviation_key,
                    path = x.invitation_img_path
                }).ToList();
            };
            return(PartialView("_InvitationTemplates", inviteList));
        }
Ejemplo n.º 30
0
        public ActionResult SendInvitations(int eventId)
        {
            try
            {
                using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
                {
                    var events = dbcontext.mblist_events_detail.Find(eventId);
                    if (events != null)
                    {
                        var guests = dbcontext.mblist_event_guests.Where(x => x.guest_event_key == eventId && x.guest_stand_by != true);
                        if (guests.Any())
                        {
                            foreach (var guest in guests)
                            {
                                var userInfor = dbcontext.mblist_user_info.Where(x => x.usr_aspnet_user == guest.guest_user_key).FirstOrDefault();
                                if (userInfor != null)
                                {
                                    string username = userInfor.usr_first_name + " " + userInfor.usr_last_name;
                                    var    type     = dbcontext.mblist_type.Find(events.event_detail_type_key);
                                    string _type    = "";
                                    if (type != null)
                                    {
                                        _type = type.type_name;
                                    }
                                    string template     = events.mblist_invitation_cards != null ? events.mblist_invitation_cards.invitation_img_path : string.Empty;
                                    string fontcolor    = events.event_font_color;
                                    string subjectcolor = events.event_subject_color;
                                    string subject      = events.event_subject;

                                    string datetime = events.event_detail_date.ToString("dd/MMM/yyyy hh:mm tt ");
                                    string body     = PopulateBody(username, events.event_detail_title, datetime, events.event_detail_address, _type, template, fontcolor, subjectcolor, subject);
                                    string email    = userInfor.AspNetUsers.Email;
                                    SendHtmlFormattedEmail(email, "MABRUKLIST INVITATION", body);
                                }
                            }
                            return(Json(new { key = true, value = "Invitations send successfully" }, JsonRequestBehavior.AllowGet));
                        }
                        return(Json(new { key = false, value = "Unable to process your request.Please contact your admin" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { key = false, value = "Event not Found. Please contact your admin" }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            catch (Exception e)
            {
                return(Json(new { key = false, value = "Unable to process your request. Please contact your admin" }, JsonRequestBehavior.AllowGet));
            }
        }