Пример #1
0
        public ContactSuggestions GetContact()
        {
            ContactSuggestions objContact = null;

            if (Session["UserDetails"] != null)
            {
                objContact = new ContactSuggestions();
                ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
                UserDetails objUserDetails = new UserDetails();
                DataTable   dtContact      = new DataTable();
                dtContact = objUserDetails.GetContacts(Convert.ToInt32(objSource.ContactId), null, "");
                if (dtContact.Rows.Count > 0)
                {
                    objContact.SourceId        = Convert.ToInt32(dtContact.Rows[0]["SourceId"]);
                    objContact.Source          = Convert.ToString(dtContact.Rows[0]["Name"]);
                    objContact.ContactId       = Convert.ToInt32(dtContact.Rows[0]["ContactId"]);
                    objContact.Contact         = Convert.ToString(dtContact.Rows[0]["ContactName"]);
                    objContact.Location4       = Convert.ToString(dtContact.Rows[0]["LocationId1"]);
                    objContact.Location5       = Convert.ToString(dtContact.Rows[0]["LocationId2"]);
                    objContact.Location6       = Convert.ToString(dtContact.Rows[0]["LocationId3"]);
                    objContact.ContactNumber   = Convert.ToString(dtContact.Rows[0]["ContactNumber"]);
                    objContact.ContactComments = Convert.ToString(dtContact.Rows[0]["Comments"]);
                }
                ViewBag.ContactComments = objContact.ContactComments;
                ViewBag.Comments        = objContact.Comments;
            }
            return(objContact);
        }
Пример #2
0
        public ActionResult Suggestion(string catId, string SubCatId, string bussiness, string location, int?microCat, bool?isLocal)
        {
            ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
            DataTable          dtContact             = new DataTable();
            UserDetails        objUserDetails        = new UserDetails();
            ContactSuggestions objContactSuggestions = new ContactSuggestions();

            // ViewBag.MySuggesstion = GetMySuggesstion();
            dtContact = objUserDetails.GetSuggestionFilters(Convert.ToInt32(catId), Convert.ToInt32(SubCatId), null, objSource.ContactId, "", null, bussiness, isLocal, location, microCat).Tables[0];

            IList <ContactSuggestions> items = dtContact.AsEnumerable().Select(row =>
                                                                               new ContactSuggestions
            {
                ContactNumber     = row.Field <string>("ContactNumber"),
                BusinessName      = row.Field <string>("BusinessName"),
                BusinessContact   = row.Field <string>("BusinessContact"),
                Category          = row.Field <string>("CategoryName"),
                SubCategory       = row.Field <string>("SubCategoryName"),
                Microcategory     = row.Field <string>("Microcategory"),
                SourceName        = row.Field <string>("SourceName"),
                Location1         = row.Field <string>("LocationId1"),
                CitiLevelBusiness = row.Field <bool>("CitiLevelBusiness"),
                Comments          = row.Field <string>("Comments"),
                ContactName       = row.Field <string>("ContactName"),
                microcateId       = row.Field <int?>("MicrocategoryId"),
                SubCategoryId     = row.Field <int>("SubCategory")
            }).ToList();


            // return View(items.ToList());

            return(Json(items, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult SkipVedio(bool skip)
        {
            string controllerName = string.Empty;
            string actionName     = string.Empty;

            ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
            UserDetails objUserDetails = new UserDetails();

            if (objUserDetails.UpdateSkipVedio(objSource.ContactId, skip))
            {
                if (objSource.Role == 2)
                {
                    controllerName = "ContactDetails";
                    actionName     = "Create";
                }
                else
                {
                    controllerName = "ContactDetails";
                    actionName     = "Create";
                }
            }

            return(Json(new
            {
                redirectUrl = Url.Action(actionName, controllerName),
                isRedirect = true,
                Message = ""
            }));
        }
        public ActionResult Index(string ContactName)
        {
            ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dtLocation = objUserDetails.GetContacts(null, Convert.ToInt32(objSource.SourceId), "");
            IList <Contacts> items = dtLocation.AsEnumerable().Select(row =>
                                                                      new Contacts
            {
                ContactName   = row.Field <string>("ContactName"),
                ContactNumber = row.Field <string>("ContactNumber")
            }).ToList();

            Contacts objContact = new Contacts();

            if (ContactName == null)
            {
                objContact.ContactsList = items.ToList();
            }
            else
            {
                objContact.ContactsList = items.ToList().Where(a => a.ContactName.ToUpper().Contains(ContactName.ToUpper())).ToList();
            }
            return(View(objContact));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "MicroId,Name,SubCateId")] MicroCategory microCategory)
        {
            if (ModelState.IsValid)
            {
                Session["subCatId"] = null;
                ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
                UserDetails objUserDetails = new UserDetails();
                string[]    myStrName      = microCategory.Name.Split('-');
                microCategory.Name = myStrName[0] + " © ";
                if (myStrName.Length > 1)
                {
                    microCategory.Name = microCategory.Name + myStrName[1];
                }

                if (objUserDetails.SaveMicroCategory(microCategory.SubCateId, microCategory.Name.Trim(), objSource.SourceId, microCategory.MicroId))
                {
                    TempData["Success"] = "Micro category saved successfully.";
                }
                else
                {
                    TempData["Success"] = "Duplicate micro category found.";
                }
                ViewBag.MicroCategory = new MicroCategory();
                ViewBag.CategoryTab   = GetCate();
                return(RedirectToAction("Index"));
            }
            return(View(microCategory));
        }
        // GET: SourceContact/Create
        public ActionResult Create()
        {
            Contacts objContact = new Contacts();

            ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
            if (!objSource.IsInterns)
            {
                objContact.ContactSourceId = objSource.SourceId;
            }
            ViewBag.Comments = objContact.Comments;
            if (TempData["Success"] == null)
            {
                TempData["Success"] = null;
            }
            return(View(objContact));
        }
        public ActionResult IsValid(int?id)
        {
            UserDetails objUserDetails = new UserDetails();

            ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                Guid objGuid = Guid.NewGuid();
                objUserDetails.VerifySuggesion(Convert.ToInt32(id), objGuid.ToString(), objSource.ContactId);
                TempData["Success"] = "Validated Successfully!";
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Create([Bind(Include = "ContactSourceId,ContactName,ContactNumber,Location1,Location2,Location3,Comments,ContactLevelUnderstating,Notification,IsContactDetailsAdded")] Contacts contact)
        {
            if (ModelState.IsValid)
            {
                if (Session["UserDetails"] != null)
                {
                    UserDetails objUserDetails = new UserDetails();
                    contact.ContactNumber = objUserDetails.MobileFormat(contact.ContactNumber);
                    Int64 isNumber = 0;
                    Int64.TryParse(contact.ContactNumber, out isNumber);
                    if (contact.ContactNumber.Length == 10 && isNumber > 0)
                    {
                        if (!string.IsNullOrEmpty(contact.Location1) && !string.IsNullOrEmpty(contact.Location2) && !string.IsNullOrEmpty(contact.Location3))
                        {
                            contact.IsContactDetailsAdded = true;
                        }

                        if (objUserDetails.SaveContact(contact.ContactSourceId, contact.ContactName, contact.ContactNumber, contact.Location1, contact.Location2, contact.Location3, contact.Comments, contact.ContactLevelUnderstating, contact.Notification, contact.IsContactDetailsAdded))
                        {
                            TempData["Success"] = "Added Successfully!";
                        }
                        else
                        {
                            TempData["Success"] = "Duplicate contact!";
                        }
                    }
                    else
                    {
                        TempData["Success"] = "Invalid  contact number!";
                        return(RedirectToAction("Create", contact));
                    }
                    Contacts objContact = new Contacts();
                    ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
                    objContact.SourceId = objSource.SourceId;
                    return(RedirectToAction("Create", objContact));
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            return(View());
        }
Пример #9
0
        public ActionResult Edit([Bind(Include = "MicroId,Name,SubCateId")] MicroCategory microCategory)
        {
            ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
            UserDetails objUserDetails = new UserDetails();

            if (ModelState.IsValid)
            {
                Session["subCatId"] = null;
                if (objUserDetails.SaveMicroCategory(microCategory.SubCateId, microCategory.Name, objSource.SourceId, microCategory.MicroId))
                {
                    TempData["Success"] = "Micro category updated successfully.";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["Success"] = "Duplicate micro category found.";
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.MicroCategory = new MicroCategory();
            ViewBag.CategoryTab   = GetCate();
            return(View(microCategory));
        }
        public ActionResult Create([Bind(Include = "CatId,SubCategoryId,MicrocategoryId,ContactId,Text,NotificationType,NotificationTitle,LocationId,NotificationPhoto,ProvdReqdsuggData,ModuleName,RedirectToType")] RequestNotificationViewModel reqSug)
        {
            if (ModelState.IsValid)
            {
                ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
                //  UserDetails objUserDetails = new UserDetails();
                //string deviceID = string.Empty;
                //string token = string.Empty;
                //string type = string.Empty;
                UserDetails objUserDetails  = new UserDetails();
                DataTable   dtDeviceDetails = new DataTable();
                DataTable   dtlocation      = new DataTable();
                DataTable   dtDeviceUIDList = new DataTable();
                dtDeviceDetails = objUserDetails.GetDeviceDetails(reqSug.ContactId);
                for (int i = 0; i < dtDeviceDetails.Rows.Count; i++)
                {
                    if (string.IsNullOrEmpty(reqSug.NotificationPhoto))
                    {
                        reqSug.NotificationPhoto = "http://tagaboutit.com/Images/phone-display-round-icon.png";
                    }
                    if (reqSug.NotificationType == "Ranking")
                    {
                        reqSug.RedirectTo = "http://tagaboutit.com/login/Ranking";
                    }
                    if (reqSug.NotificationType == "ReqAddSug")
                    {
                        reqSug.RedirectTo = "AddSugg";
                    }
                    if (reqSug.NotificationType == "ProvdReqdsugg")
                    {
                        reqSug.RedirectTo = reqSug.ProvdReqdsuggData;
                    }
                    if (reqSug.NotificationType == "Reqdsuggprovd")
                    {
                        reqSug.RedirectTo = "ViewSugg";
                    }
                    if (reqSug.NotificationType == "MyDetail")
                    {
                        reqSug.RedirectTo = "MyDetail";
                    }
                    if (reqSug.NotificationType == "ModYourSug")
                    {
                        reqSug.RedirectTo = "ViewSugg";
                    }

                    if (Convert.ToInt32(reqSug.RedirectToType) == 1)
                    {
                        reqSug.RedirectTo = reqSug.ModuleName;
                    }
                    if (objUserDetails.SaveNotificationForWebSend(reqSug.UID, reqSug.SubCategoryId, reqSug.MicrocategoryId, reqSug.ContactId, Convert.ToInt32(dtDeviceDetails.Rows[i]["UID"]), reqSug.Text, reqSug.NotificationType, false, reqSug.NotificationTitle, reqSug.LocationId, reqSug.NotificationPhoto, reqSug.RedirectTo, objSource.ContactId, Convert.ToInt32(reqSug.RedirectToType)))
                    {
                        TempData["Success"] = "Added Successfully!";
                        // deviceID = Convert.ToString(dtDeviceDetails.Rows[i]["DeviceID"]);
                        // type = Convert.ToString(dtDeviceDetails.Rows[i]["Type"]);
                        // token = Convert.ToString(dtDeviceDetails.Rows[i]["Token"]);
                        if (reqSug.NotificationType == "ProvdReqdsugg")
                        {
                            dtDeviceDetails = objUserDetails.GetSourcesToken().Tables[0];
                            dtDeviceUIDList = objUserDetails.GetSourcesToken().Tables[1];
                        }
                        else
                        {
                            dtDeviceDetails = objUserDetails.GetSourcesTokenByContactId(reqSug.ContactId).Tables[0];
                            dtDeviceUIDList = objUserDetails.GetSourcesTokenByContactId(reqSug.ContactId).Tables[1];
                        }
                        // string[] strSplit = Convert.ToString(dtDeviceDetails.Rows[0]["TokenList"]).Length > 0 ? Convert.ToString(dtDeviceDetails.Rows[0]["TokenList"]).Split('|') : null;
                        PushAndroidNotification(Convert.ToString(dtDeviceDetails.Rows[0]["TokenList"]), reqSug.CatId, reqSug.SubCategoryId, reqSug.MicrocategoryId, reqSug.LocationId, reqSug.NotificationTitle, reqSug.Text, Convert.ToString(dtDeviceUIDList.Rows[0]["UIDList"]));
                    }
                    else
                    {
                        TempData["Success"] = "Some issue found!";
                    }
                }
                if (dtDeviceDetails.Rows.Count == 0)
                {
                    TempData["Success"] = "No device registered for this contact.";
                }
            }
            RequestNotificationViewModel objRequestNotificationViewModel = new RequestNotificationViewModel();
            DataTable   dtContact             = new DataTable();
            UserDetails objUserDetailsForView = new UserDetails();
            Category    objCategory           = new Category();

            dtContact = objUserDetailsForView.GetCategory(null, null).Tables[0];
            IList <Category> items = dtContact.AsEnumerable().Select(row =>
                                                                     new Category
            {
                CatId         = row.Field <int>("CatId"),
                Name          = row.Field <string>("Name"),
                SubCategories = GetSubCate(row.Field <int>("CatId"))
            }).ToList();

            FillCityDrodown();
            objRequestNotificationViewModel.Categories = items;

            return(View(objRequestNotificationViewModel));
        }
        public ActionResult Edit([Bind(Include = "UID, SourceId,  ContactId,  Category,  SubCategory,  Microcategory,  BusinessName,  CitiLevelBusiness,  BusinessContact,  Location1,  Comments, IsAChain,  Platform,  CityName,ReasonForChange")] ContactSuggestions contactSugg)
        {
            int locID   = Convert.ToInt32(contactSugg.Location1);
            int?micorID = null;

            if (!string.IsNullOrEmpty(contactSugg.Microcategory))
            {
                micorID = Convert.ToInt32(contactSugg.Microcategory);
            }
            if (ModelState.IsValid)
            {
                string message = string.Empty;
                //  CustomResponseMessage custMessage = new CustomResponseMessage();
                ContactSuggestion.Models.Source objSource = (ContactSuggestion.Models.Source)Session["UserDetails"];
                UserDetails objUserDetails = new UserDetails();
                try
                {
                    DataTable dtDeviceDetails = objUserDetails.GetSourcesTokenByContactId(contactSugg.ContactId).Tables[0];

                    DataTable dtDevices = objUserDetails.GetDeviceDetails(contactSugg.ContactId);

                    //ContactSuggestions objContactSugg = GetContact(contactSugg.contactId);
                    contactSugg.BusinessContact = objUserDetails.MobileFormat(contactSugg.BusinessContact);

                    DataTable dtLocation = objUserDetails.GetLocation(Convert.ToInt32(contactSugg.Location1), string.Empty, string.Empty, Convert.ToInt32(contactSugg.CityName));
                    contactSugg.Location1 = string.IsNullOrEmpty(Convert.ToString(dtLocation.Rows[0]["LocationName"])) ? Convert.ToString(dtLocation.Rows[0]["Suburb"]).Trim() : Convert.ToString(dtLocation.Rows[0]["LocationName"]).Trim() + " - " + Convert.ToString(dtLocation.Rows[0]["Suburb"]).Trim();
                    contactSugg.Location2 = Convert.ToString(dtLocation.Rows[0]["LocationId"]);
                    contactSugg.Location3 = Convert.ToString(dtLocation.Rows[0]["AreaShortCode"]);
                    if (!string.IsNullOrEmpty(contactSugg.BusinessContact))
                    {
                        Int64 isNumber = 0;
                        Int64.TryParse(contactSugg.BusinessContact, out isNumber);
                        if (contactSugg.BusinessContact.Length == 10 && isNumber > 0)
                        {
                            if (objUserDetails.UpdateContactSuggestions(Convert.ToInt32(contactSugg.UID), contactSugg.SourceId, contactSugg.ContactId, contactSugg.Category, contactSugg.SubCategory, contactSugg.Microcategory, contactSugg.BusinessName, contactSugg.CitiLevelBusiness, contactSugg.BusinessContact, contactSugg.Location1, contactSugg.Location2, contactSugg.Location3, contactSugg.Comments, "", "", "", "", contactSugg.ContactComments, contactSugg.IsAChain, contactSugg.Platform, Convert.ToInt32(contactSugg.CityName)))
                            {
                                for (int i = 0; i < dtDevices.Rows.Count; i++)
                                {
                                    objUserDetails.SaveNotificationForWebSend(0, Convert.ToInt32(contactSugg.SubCategory), micorID, contactSugg.ContactId, Convert.ToInt32(dtDevices.Rows[i]["UID"]), contactSugg.ReasonForChange, "ModYourSug", false, "Suggestion Updated", locID, "Suggestion Updated", "ViewSugg", objSource.ContactId, null);
                                }
                                // custMessage.action = "Success";
                                // custMessage.message = "Update Successfully!";
                                TempData["Success"] = "Update Successfully!";

                                PushAndroidNotification(Convert.ToString(dtDeviceDetails.Rows[0]["TokenList"]), Convert.ToInt32(contactSugg.Category), Convert.ToInt32(contactSugg.SubCategory), Convert.ToInt32(contactSugg.Microcategory), Convert.ToInt32(locID), contactSugg.ReasonForChange, "", "", contactSugg.BusinessName, contactSugg.ContactId.ToString(), contactSugg.UID, contactSugg.ReasonForChange);
                            }
                            else
                            {
                                // custMessage.action = "Failure";
                                // custMessage.message = "Please choose different Business Name and Location!.";
                                // return Request.CreateResponse(HttpStatusCode.ExpectationFailed, custMessage);
                                TempData["Success"] = "Please choose different Business Name and Location!";
                            }
                        }
                        else
                        {
                            //// custMessage.action = "Failure";
                            // custMessage.message = "Invalid Business contact number!";
                            //return Request.CreateResponse(HttpStatusCode.ExpectationFailed, custMessage);
                            TempData["Success"] = "Invalid Business contact number!";
                        }
                    }
                    else
                    {
                        if (objUserDetails.UpdateContactSuggestions(Convert.ToInt32(contactSugg.UID), contactSugg.SourceId, contactSugg.ContactId, contactSugg.Category, contactSugg.SubCategory, contactSugg.Microcategory, contactSugg.BusinessName, contactSugg.CitiLevelBusiness, contactSugg.BusinessContact, contactSugg.Location1, contactSugg.Location2, contactSugg.Location3, contactSugg.Comments, "", "", "", "", contactSugg.ContactComments, contactSugg.IsAChain, contactSugg.Platform, Convert.ToInt32(contactSugg.CityName)))
                        {
                            for (int i = 0; i < dtDevices.Rows.Count; i++)
                            {
                                objUserDetails.SaveNotificationForWebSend(0, Convert.ToInt32(contactSugg.SubCategory), micorID, contactSugg.ContactId, Convert.ToInt32(dtDevices.Rows[i]["UID"]), contactSugg.ReasonForChange, "ModYourSug", false, "Suggestion Updated", locID, "Suggestion Updated", "ViewSugg", objSource.ContactId, null);
                            }

                            // custMessage.action = "Success";
                            // custMessage.message = "Update Successfully!";
                            TempData["Success"] = "Update Successfully!";
                            PushAndroidNotification(Convert.ToString(dtDeviceDetails.Rows[0]["TokenList"]), Convert.ToInt32(contactSugg.Category), Convert.ToInt32(contactSugg.SubCategory), Convert.ToInt32(contactSugg.Microcategory), Convert.ToInt32(locID), contactSugg.ReasonForChange, "", "", contactSugg.BusinessName, contactSugg.ContactId.ToString(), contactSugg.UID, contactSugg.ReasonForChange);
                        }
                        else
                        {
                            // custMessage.action = "Failure";
                            // custMessage.message = "Please choose different Business Name and Location!.";
                            // return Request.CreateResponse(HttpStatusCode.ExpectationFailed, custMessage);
                            TempData["Success"] = "Please choose different Business Name and Location!";
                        }
                    }
                }
                catch (Exception ex)
                {
                    TempData["Success"] = ex.Message;

                    // custMessage.action = "Failure";
                    // custMessage.message = ex.Message;
                    //SendEmail(ex.Message, "suggestion PUT");
                    // return Request.CreateResponse(HttpStatusCode.ExpectationFailed, custMessage);
                }
            }
            FillCategoryDrodown(Convert.ToInt32(contactSugg.Category));
            FillSubCateDropdown(Convert.ToInt32(contactSugg.Category), Convert.ToInt32(contactSugg.SubCategory));
            FillMicroCateDropdown(Convert.ToInt32(contactSugg.SubCategory), Convert.ToInt32(contactSugg.Microcategory));
            FillCityDropdown(Convert.ToInt32(contactSugg.CityName));
            FillLocationDropdown(locID, Convert.ToInt32(contactSugg.CityName));
            return(View());
        }