コード例 #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 ContactSuggestions GetMySuggesstion()
        {
            ContactSuggestions objContact = GetContact();

            if (objContact != null)
            {
                ViewBag.ContactComments = objContact.ContactComments;
                ViewBag.Comments        = objContact.Comments;
                if (TempData["Success"] == null)
                {
                    TempData["Success"] = null;
                }
                FillCategoryDrodown();
                DataTable   dtContact      = new DataTable();
                UserDetails objUserDetails = new UserDetails();
                Category    objCategory    = new Category();

                dtContact = objUserDetails.GetMySuggestionCategoryWise(objContact.ContactNumber);
                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"), objContact.ContactNumber)
                }).ToList();

                // var list = new SelectList(items, "CatId", "Name");
                objContact.Categories = items;
            }
            return(objContact);
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "SourceId,ContactId,Source,Contact,CatId,SubCategory,Microcategory,CitiLevelBusiness,BusinessName,BusinessContact,Location1,Location2,Location3,Comments,Location4,Location5,Location6,ContactComments,SubCategoryId,Details,IsAChain")] ContactSuggestions contactSugg, string mydrop)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    TempData["Invalid"] = null;
                    ContactSuggestions objContact = GetContact();
                    if (objContact != null)
                    {
                        string      location       = contactSugg.Location1 == null ? "" : contactSugg.Location1.Trim();
                        bool        isValidNumber  = false;
                        UserDetails objUserDetails = new UserDetails();
                        if (!string.IsNullOrEmpty(contactSugg.BusinessContact))
                        {
                            contactSugg.BusinessContact = objUserDetails.MobileFormat(contactSugg.BusinessContact);
                            Int64 isNumber = 0;
                            Int64.TryParse(contactSugg.BusinessContact, out isNumber);
                            if ((contactSugg.BusinessContact.Length == 10 && isNumber > 0))
                            {
                                isValidNumber = true;
                            }
                        }
                        if (string.IsNullOrEmpty(contactSugg.BusinessContact) || isValidNumber == true)
                        {
                            contactSugg.Microcategory = mydrop + " © " + contactSugg.Details;
                            if (objUserDetails.SaveContactSuggestions(contactSugg.SourceId, contactSugg.ContactId, contactSugg.CatId.ToString(), contactSugg.SubCategoryId.ToString(), contactSugg.Microcategory, contactSugg.BusinessName, contactSugg.CitiLevelBusiness, contactSugg.BusinessContact, location, contactSugg.Location2, contactSugg.Location3, contactSugg.Comments, "", contactSugg.Location4, contactSugg.Location5, contactSugg.Location6, contactSugg.ContactComments, contactSugg.IsAChain, "Web", 1, 1, false))
                            {
                                TempData["Success"] = "Added Successfully!";
                            }
                        }
                        else
                        {
                            TempData["Success"] = "Invalid Business contact number!";
                            TempData["Invalid"] = contactSugg;

                            return(RedirectToAction("Create", contactSugg));
                        }
                        return(RedirectToAction("Create", objContact));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Login"));
                    }
                }
                return(View());
                // TODO: Add insert logic here

                // return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                TempData["Success"] = ex.Message;
                return(RedirectToAction("Create", contactSugg));
            }
        }
コード例 #5
0
        public ActionResult Create()
        {
            DataTable   dtContact      = new DataTable();
            UserDetails objUserDetails = new UserDetails();
            Category    objCategory    = new Category();

            if (TempData["Invalid"] == null)
            {
                ContactSuggestions objContact = GetContact();
                if (objContact != null)
                {
                    ViewBag.ContactComments = objContact.ContactComments;
                    ViewBag.Comments        = objContact.Comments;
                    if (TempData["Success"] == null)
                    {
                        TempData["Success"] = null;
                    }
                    FillCategoryDrodown();


                    dtContact = objUserDetails.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();

                    // var list = new SelectList(items, "CatId", "Name");
                    objContact.Categories = items;

                    return(View(objContact));
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            else
            {
                ContactSuggestions objContact = (ContactSuggestions)TempData["Invalid"];
                dtContact = objUserDetails.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();

                // var list = new SelectList(items, "CatId", "Name");
                objContact.Categories = items;
                return(View(objContact));
            }
        }
コード例 #6
0
        public ActionResult MySuggestion()
        {
            ContactSuggestions objContact = GetMySuggesstion();

            if (objContact != null)
            {
                return(View(objContact));
            }

            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
コード例 #7
0
        public ActionResult MyDetails()
        {
            ContactSuggestions objContact = GetContact();

            if (objContact != null)
            {
                ViewBag.ContactComments = objContact.ContactComments;
                ViewBag.Comments        = objContact.Comments;
                if (TempData["Success"] == null)
                {
                    TempData["Success"] = null;
                }
                return(View(objContact));
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
コード例 #8
0
        public ActionResult BindCategory()
        {
            ContactSuggestions objContact     = new ContactSuggestions();
            DataTable          dtContact      = new DataTable();
            UserDetails        objUserDetails = new UserDetails();
            Category           objCategory    = new Category();

            dtContact = objUserDetails.GetCategory(null, null).Tables[1];
            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"), null)
            }).ToList();

            objContact.Categories = items;
            return(View(objContact));
        }
コード例 #9
0
        // GET: Microcategory
        public ActionResult Index(int?subCatId)
        {
            if (subCatId != null)
            {
                Session["subCatId"] = subCatId;
            }
            else
            {
                Session["subCatId"] = null;
            }

            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dtLocation = objUserDetails.GetMicroCategory(subCatId, null);
            IList <MicroCategory> items = dtLocation.AsEnumerable().Select(row =>
                                                                           new MicroCategory
            {
                MicroId     = row.Field <int>("MicroId"),
                Name        = row.Field <string>("Name"),
                SubCateName = row.Field <string>("SubCateName"),
                SubCateId   = row.Field <int>("SubCateId")
            }).ToList();

            ViewBag.MicroCategory = new MicroCategory();
            ContactSuggestions objContactSug = new ContactSuggestions();

            objContactSug = GetCate();
            if (subCatId != null)
            {
                // objContactSug.Category = Convert.ToString(objUserDetails.GetSubCategorName(subCategoryId).Rows[0]["CategoryName"]);
                ViewBag.Category = Convert.ToString(objUserDetails.GetSubCategorName(subCatId).Rows[0]["CategoryName"]);
                // objContactSug.SubCategory ="->"+ Convert.ToString(objUserDetails.GetSubCategorName(subCategoryId).Rows[0]["SubCateName"]);
                ViewBag.SubCategory = "->" + Convert.ToString(objUserDetails.GetSubCategorName(subCatId).Rows[0]["SubCateName"]);
            }
            ViewBag.CategoryTab = GetCate();


            return(View(items.ToList()));
        }
コード例 #10
0
        public ActionResult Edit(int?id)
        {
            string      sugID          = Convert.ToString(id);
            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dtLocation = objUserDetails.GetSuggestionFilters(null, null, id, null, "", null, "", null, "", null).Tables[0];
            IList <ContactSuggestions> items = dtLocation.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"),
                CatId             = row.Field <int>("Category"),
                IsAChain          = row.Field <bool>("IsAChain"),
                UID        = Convert.ToString(row.Field <int>("UID")),
                locationId = Convert.ToInt32(row.Field <string>("LocationId2")),
                cityid     = row.Field <int?>("City")
            }).ToList();
            ContactSuggestions objContactSuggestions = items.Where(a => a.UID == sugID).FirstOrDefault();

            FillCategoryDrodown(Convert.ToInt32(objContactSuggestions.CatId));
            FillSubCateDropdown(Convert.ToInt32(objContactSuggestions.CatId), Convert.ToInt32(objContactSuggestions.SubCategoryId));
            FillMicroCateDropdown(Convert.ToInt32(objContactSuggestions.SubCategoryId), Convert.ToInt32(objContactSuggestions.microcateId));
            FillCityDropdown(objContactSuggestions.cityid);
            FillLocationDropdown(objContactSuggestions.locationId, Convert.ToInt32(objContactSuggestions.cityid));
            return(View(objContactSuggestions));
        }
コード例 #11
0
        public ActionResult MyDetails([Bind(Include = "SourceId,ContactId,Location4,Location5,Location6,ContactComments,ContactLevelUnderstating,Notification,IsContactDetailsAdded")] ContactSuggestions contactSugg)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ContactSuggestions objContact = GetContact();
                    if (objContact != null)
                    {
                        if (!string.IsNullOrEmpty(contactSugg.Location1) && !string.IsNullOrEmpty(contactSugg.Location2) && !string.IsNullOrEmpty(contactSugg.Location3))
                        {
                            contactSugg.IsContactDetailsAdded = true;
                        }

                        UserDetails objUserDetails = new UserDetails();
                        if (objUserDetails.UpdateContact(contactSugg.ContactId, contactSugg.Location4, contactSugg.Location5, contactSugg.Location6, contactSugg.ContactComments, contactSugg.ContactLevelUnderstating, contactSugg.Notification, contactSugg.IsContactDetailsAdded))
                        {
                            TempData["Success"] = "Updated Successfully!";
                        }
                        return(RedirectToAction("MyDetails", objContact));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Login"));
                    }
                }
                return(View());
                // TODO: Add insert logic here

                // return RedirectToAction("Index");
            }
            catch
            {
                return(View());
            }
        }
コード例 #12
0
        public async Task <ContactSuggestions> GetSuggestedContactList(int targetUserId)
        {
            var result = await Task.Factory.StartNew(() => Context.FNGETCONTACTSUGGESTIONS(targetUserId)).ConfigureAwait(false);

            var suggestions = result.Select(c => new SuggestedContactResponse
            {
                ContactCustomId         = c.ContactCustomID,
                ContactId               = c.ContactID,
                ContactTypeId           = (SystemContactType)c.ContactTypeID,
                UserId                  = c.UserID,
                UserName                = c.UserName,
                DisplayName             = c.DisplayName,
                Picture                 = c.Picture,
                FieldType               = (SystemContactMarkedType)c.FieldID,
                Name                    = c.Name,
                Value                   = c.Value,
                OriginalName            = c.OriginalName,
                OriginalValue           = c.OriginalValue,
                ContactChatNetworkId    = c.ContactChatNetworkID,
                ReferralContactCustomId = c.ReferralContactCustomID,
                Added                   = c.Added
            }).ToList();
            var response = new ContactSuggestions
            {
                Address      = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Address).OrderByDescending(x => x.Added),
                Email        = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Email).OrderByDescending(x => x.Added),
                Fax          = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Fax).OrderByDescending(x => x.Added),
                Mobile       = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Mobile).OrderByDescending(x => x.Added),
                Phone        = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Phone).OrderByDescending(x => x.Added),
                Website      = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Website).OrderByDescending(x => x.Added),
                ChatNetworks = suggestions.Where(x => x.FieldType.IsChatNetwork()).OrderBy(x => x.FieldType).ThenByDescending(x => x.Added),
                Customs      = suggestions.Where(x => x.FieldType == SystemContactMarkedType.Custom).OrderByDescending(x => x.Added)
            };

            return(response);
        }
コード例 #13
0
        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());
        }
コード例 #14
0
        // GET: SuggetionList
        public ActionResult Index(string Category, string StartDate, string EndDate, string SubCategory, string Microcategory, string BusinessName, string CityName, string Location1, string Source, string Contact, string Platform, string IsValid, string VendorIsVerified, string IsChain, string isLocal)
        {//string option, string search, int? pageNumber
            int?locId = null;

            if (!string.IsNullOrEmpty(Location1))
            {
                locId = Convert.ToInt32(Location1);
            }
            int cityId = 0;

            if (!string.IsNullOrEmpty(CityName))
            {
                cityId = Convert.ToInt32(CityName);
            }

            ContactSuggestions objContactSuggestion = new ContactSuggestions();
            // List<ContactSuggestions> objList = new List<ContactSuggestions>();
            // objContactSuggestion.ContactSuggestionsList = objList;
            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            // int? cateID = !string.IsNullOrEmpty(Category)
            if (locId != null)
            {
                DataTable dtAllLocation = objUserDetails.GetLocation(locId, string.Empty, string.Empty, cityId);
                Location1 = string.IsNullOrEmpty(Convert.ToString(dtAllLocation.Rows[0]["LocationName"])) ? Convert.ToString(dtAllLocation.Rows[0]["Suburb"]).Trim() : Convert.ToString(dtAllLocation.Rows[0]["LocationName"]).Trim() + " - " + Convert.ToString(dtAllLocation.Rows[0]["Suburb"]).Trim();
            }

            dtLocation = objUserDetails.GetSuggestionList(ReturnData <int?>(Category), ReturnData <int?>(SubCategory), null, ReturnData <int?>(Contact), "", ReturnData <int?>(Source), ReturnData <string>(BusinessName), ReturnData <bool?>(isLocal), ReturnData <string>(Location1), ReturnData <int?>(Microcategory), "", ReturnData <int?>(CityName), ReturnData <DateTime?>(StartDate), ReturnData <DateTime?>(EndDate), ReturnData <bool?>(IsChain), ReturnData <bool?>(IsValid), ReturnData <bool?>(IsValid)).Tables[0];
            IList <ContactSuggestions> items = dtLocation.AsEnumerable().Select(row =>
                                                                                new ContactSuggestions
            {
                UID             = row.Field <int>("UID").ToString(),
                BusinessName    = row.Field <string>("BusinessName") == null?"": row.Field <string>("BusinessName"),
                BusinessContact = row.Field <string>("BusinessContact") == null?"": row.Field <string>("BusinessContact"),
                CityName        = row.Field <string>("CityName") == null?"": row.Field <string>("CityName"),
                Location1       = row.Field <string>("LocationId1") == null?"": row.Field <string>("LocationId1"),
                Microcategory   = row.Field <string>("Microcategory") == null?"": row.Field <string>("Microcategory"),
                SubCategory     = row.Field <string>("SubCategoryName") == null?"": row.Field <string>("SubCategoryName"),
                Category        = row.Field <string>("CategoryName") == null?"": row.Field <string>("CategoryName"),
                Source          = row.Field <string>("SourceName") == null?"" : row.Field <string>("SourceName"),
                Contact         = row.Field <string>("ContactName") == null?"": row.Field <string>("ContactName"),
                AddedWhen       = row.Field <string>("AddedWhen") == null? "": row.Field <string>("AddedWhen"),
                Platform        = row.Field <string>("Platform") == null?"": row.Field <string>("Platform"),
                Chain           = row.Field <string>("IsAChain") == null?"":row.Field <string>("IsAChain"),
                Local           = row.Field <string>("CitiLevelBusiness") == null?"": row.Field <string>("CitiLevelBusiness"),
                IsVerified      = row.Field <string>("VendorIsVerified") == null?"":row.Field <string>("VendorIsVerified"),
                IsActive        = row.Field <string>("IsValid") == null?"": row.Field <string>("IsValid"),
                Maps            = row.Field <string>("ShowMaps") == null?"": row.Field <string>("ShowMaps"),
                DataActive      = row.Field <string>("IsActive") == null?"": row.Field <string>("IsActive"),
                GoogleMaps      = "https://www.google.com/maps/search/" + (row.Field <string>("BusinessName") == null?"": row.Field <string>("BusinessName").Trim()) + "+" + (row.Field <string>("LocationId1") != null? (row.Field <string>("LocationId1").Split('-').Length > 1 ? row.Field <string>("LocationId1").Split('-')[1] : row.Field <string>("LocationId1")):"").Trim()
            }).ToList();

            objContactSuggestion.ContactSuggestionsList = items;
            FillCategoryDrodown();
            FillSubCate(Category);
            FillMicroCate(SubCategory);
            City();
            BindSource();
            FillContact(Source);
            PlatformBind();
            FillLocation(CityName);
            return(View(objContactSuggestion));
        }
コード例 #15
0
        // GET: SuggetionList
        public ActionResult Index()
        {
            DataTable          dtExistingRecord     = new DataTable();
            DataTable          dtNewRecord          = new DataTable();
            UserDetails        objUserDetails       = new UserDetails();
            ContactSuggestions objContactSuggestion = new ContactSuggestions();

            dtExistingRecord = objUserDetails.GetBulkNotificationData().Tables[0];
            dtNewRecord      = objUserDetails.GetBulkNotificationData().Tables[1];
            IList <ResendNotification> itemsResendNotification = dtExistingRecord.AsEnumerable().Select(row =>
                                                                                                        new ResendNotification
            {
                UID                = row.Field <int>("UID"),
                DeviceUID          = row.Field <int>("DeviceUID"),
                Text               = row.Field <string>("Text"),
                NotificationType   = row.Field <string>("NotificationType"),
                NotificationTitle  = row.Field <string>("NotificationTitle"),
                Location           = row.Field <int?>("LocationId") == null? "": getlocationName(row.Field <int>("LocationId")),
                Sent               = row.Field <bool>("Sent"),
                Target             = row.Field <int?>("Target"),
                ScheduleTIme       = row.Field <DateTime?>("ScheduleTIme"),
                ConfirmTime        = row.Field <DateTime?>("ConfirmTime"),
                SubCategory        = row.Field <int?>("SubCategoryId"),
                Microcategory      = row.Field <int?>("MicrocategoryId"),
                TimeSent           = row.Field <DateTime?>("TimeSent"),
                IsDone             = row.Field <bool?>("IsDone"),
                IsDismissed        = row.Field <bool?>("IsDismissed"),
                RequestID          = row.Field <int?>("RequestID"),
                RedirectTo         = row.Field <string>("RedirectTo"),
                SentNotificationBy = row.Field <int?>("SentNotificationBy"),
                ContactId          = row.Field <int>("ContactId")
            }).ToList();

            IList <SentNotification> itemsSentNotification = dtExistingRecord.AsEnumerable().Select(row =>
                                                                                                    new SentNotification
            {
                ContactId                = row.Field <int>("ContactId"),
                Name                     = row.Field <string>("ContactName"),
                Number                   = row.Field <string>("ContactNumber"),
                SourceId                 = row.Field <int>("SourceId"),
                Source                   = Convert.ToString(GetSourceById(row.Field <int>("SourceId")).Rows[0]["Name"]),
                SourceNo                 = Convert.ToString(GetSourceById(row.Field <int>("SourceId")).Rows[0]["Mobile"]),
                HomeLocation             = row.Field <string>("LocationId1"),
                WorkLocation             = row.Field <string>("LocationId2"),
                CollegeSchoolLocation    = row.Field <string>("LocationId3"),
                ProfeDetails             = row.Field <string>("Comments"),
                AllowedRequestSuggestion = row.Field <bool>("AllowProvideSuggestion")
            }).ToList();

            objContactSuggestion.ResendNotificationList = itemsResendNotification;
            objContactSuggestion.SentNotificationList   = itemsSentNotification;
            //FillCategoryDrodown();
            //FillSubCate(Category);
            //FillMicroCate(SubCategory);
            //City();
            //BindSource();
            //FillContact(Source);
            //PlatformBind();
            //GetAreaDropdown(CityName,);
            return(View(objContactSuggestion));
        }