Exemple #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);
        }
        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));
        }
        public JsonResult ViewMyContacts(int sourceId)
        {
            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dtLocation = objUserDetails.GetContacts(null, sourceId, "");
            IList <Contacts> items = dtLocation.AsEnumerable().Select(row =>
                                                                      new Contacts
            {
                ContactName   = row.Field <string>("ContactName"),
                ContactNumber = row.Field <string>("ContactNumber"),
                SoruceName    = row.Field <string>("Name"),
                Location1     = row.Field <string>("LocationId1"),
                Location2     = row.Field <string>("LocationId2"),
                Location3     = row.Field <string>("LocationId3"),
                ContactId     = row.Field <int>("ContactId")
            }).ToList();

            var location = (from loc in items
                            select new
            {
                label = loc.ContactName.Trim(),
                val = loc.ContactId
            }).ToList();

            return(Json(location));
        }
        public ActionResult SendRequest(int cityId, int platform, int?subcatid, string contactnumber)
        {
            UserDetails objUserDetails      = new UserDetails();
            DataTable   dtRequestSuggestion = new DataTable();
            DataTable   dtCategory          = new DataTable();
            DataTable   dtContactId         = new DataTable();

            dtCategory = objUserDetails.GetSubCategory(null, subcatid == null?-1:subcatid, null).Tables[0];
            int CatId         = 0;
            int SubCategoryID = Convert.ToInt32(subcatid);

            if (dtCategory.Rows.Count > 0)
            {
                CatId = Convert.ToInt32(dtCategory.Rows[0]["CatId"]);
            }
            dtContactId = objUserDetails.GetContacts(null, null, contactnumber);
            if (dtContactId.Rows.Count == 0)
            {
                return(View());
            }
            int ContactId = Convert.ToInt32(dtContactId.Rows[0]["ContactId"]);
            RequestSuggetions objRequestSugg = new RequestSuggetions();

            objRequestSugg.cityId        = cityId;
            objRequestSugg.platform      = platform;
            objRequestSugg.categoryId    = CatId;
            objRequestSugg.subCategoryId = SubCategoryID;
            objRequestSugg.contactId     = ContactId;

            FillCategoryDrodown(CatId);
            FillSubCate(CatId, SubCategoryID);
            FillMicroCate(SubCategoryID);

            return(View(objRequestSugg));
        }
        public JsonResult ContactLookup(string prefix)
        {
            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dtLocation = objUserDetails.GetContacts(null, null, "");
            IList <Contacts> items = dtLocation.AsEnumerable().Select(row =>
                                                                      new Contacts
            {
                ContactId   = row.Field <int>("ContactId"),
                ContactName = row.Field <string>("ContactName")
            }).ToList();

            var location = (from loc in items
                            where loc.ContactName.ToUpper().Contains(prefix.ToUpper())
                            select new
            {
                label = loc.ContactName,
                val = loc.ContactId
            }).ToList();

            return(Json(location));
        }
        private void FillContact(string id)
        {
            int cid = 0;

            int.TryParse(id, out cid);
            DataTable   dtLocation     = new DataTable();
            UserDetails objUserDetails = new UserDetails();

            dtLocation = objUserDetails.GetContacts(null, cid, "");
            IList <Contacts> items = dtLocation.AsEnumerable().Select(row =>
                                                                      new Contacts
            {
                ContactName   = row.Field <string>("ContactName"),
                ContactNumber = row.Field <string>("ContactNumber"),
                SoruceName    = row.Field <string>("Name"),
                Location1     = row.Field <string>("LocationId1"),
                Location2     = row.Field <string>("LocationId2"),
                Location3     = row.Field <string>("LocationId3"),
                ContactId     = row.Field <int>("ContactId")
            }).ToList();
            var list = new SelectList(items, "ContactId", "ContactName");

            ViewData["Contact"] = list;
        }