/// <summary> /// Currents the users contacts. /// </summary> /// <param name="showActiveOnly">if set to <c>true</c> [show active only].</param> /// <returns></returns> public UserContacts CurrentUsersContacts(bool showActiveOnly = false) { try { #region pre-processing string additionalQuery = string.Empty; if (showActiveOnly) { additionalQuery = "?active=true"; } #endregion end pre-processing #region processing UserContacts result = GetRequest <UserContacts>(string.Concat(PushbulletConstants.BaseUrl, PushbulletConstants.ContactsUrls.Contacts, additionalQuery).Trim()); return(result); #endregion processing } catch (Exception) { throw; } }
public async Task <IActionResult> PutUserContacts(int id, UserContacts userContacts) { if (id != userContacts.Id) { return(BadRequest()); } _context.Entry(userContacts).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserContactsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> DeleteConfirmed(int id) { UserContacts userContacts = await db.UserContacts.FindAsync(id); db.UserContacts.Remove(userContacts); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void RetrieveContact() { try { objUserContacts = new UserContacts(); objBL_UserContacts = new BL_UserContacts(); lstUserContacts = objBL_UserContacts.SelectUserContactsListforgrid(Convert.ToInt16(HttpUtility.UrlDecode(Request.QueryString["CntId"]).ToString())); if (lstUserContacts.Count > 0) { txtCampaignName.Value = lstUserContacts[0].ContactName; EmailID.Value = lstUserContacts[0].Email_id; if (lstUserContacts[0].DateofBirth != null) { DateTime dt = Convert.ToDateTime(lstUserContacts[0].DateofBirth.ToString()); ; dtScheduledatetime.Value = String.Format("{0:dd/MM/yyyy}", dt); } if (lstUserContacts[0].Email_id != null) { EmailID.Value = lstUserContacts[0].Email_id; } if (lstUserContacts[0].City1 != null) { City.Value = lstUserContacts[0].City1; } if (lstUserContacts[0].Country1 != null) { Country.Value = lstUserContacts[0].City1; } if (lstUserContacts[0].Designation != null) { Designation.Value = lstUserContacts[0].Designation; } if (lstUserContacts[0].ContactNo != null) { ContactNo.Value = lstUserContacts[0].ContactNo; } if (lstUserContacts[0].Addressline1 != null) { Address.Value = lstUserContacts[0].Addressline1; } if (lstUserContacts[0].State1 != null) { State.Value = lstUserContacts[0].State1; } } } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("ContactsAdd.aspx:RetrieveContact() - " + ex.Message); } }
public async Task AddUserContact(User u, Contact c) { var uc = new UserContacts() { ContactId = c.Id, UserId = u.Id }; _context.UserContacts.Add(uc); await _context.SaveChangesAsync(); }
public async Task <ActionResult> Edit([Bind(Include = "IdContacts,Nombre,Apellido,FechaNac,Email,Sexo,UserID")] UserContacts userContacts) { if (ModelState.IsValid) { db.Entry(userContacts).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.UserID = new SelectList(db.Users, "UserID", "Name", userContacts.UserID); return(View(userContacts)); }
/// <summary> /// add contact in TableLayoutPanel /// </summary> public void addContact(Users user) { UserContacts contact = new UserContacts(user); contact.Dock = DockStyle.Fill; tableLayoutContact.Controls.Add(contact, Column, Row); Column += 1; if (Column == 3) { Row += 1; Column = 0; } }
public IActionResult AjaxGetContacts(string owner) { var model = _context.UserContacts.Where(el => (el.owner == owner)).SingleOrDefault(); if (model == null) { UserContacts userContacts = new UserContacts(owner, new JObject()); _context.Add(userContacts); _context.SaveChanges(); model = _context.UserContacts.SingleOrDefault(el => (el.owner == owner)); } return(View(model)); }
public async Task <IActionResult> Create(string owner) { UserContacts userContacts = new UserContacts(owner, new JObject()); if (ModelState.IsValid) { _context.Add(userContacts); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Index))); }
// GET: UserContacts/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserContacts userContacts = await db.UserContacts.FindAsync(id); if (userContacts == null) { return(HttpNotFound()); } return(View(userContacts)); }
// GET: UserContacts/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserContacts userContacts = await db.UserContacts.FindAsync(id); if (userContacts == null) { return(HttpNotFound()); } ViewBag.UserID = new SelectList(db.Users, "UserID", "Name", userContacts.UserID); return(View(userContacts)); }
public DataSet SelectUserContactsbasedonIDFilter(string ContactName, string Designation, string city, string state, string country, string emailid, string contactno, int FKid, string alpha) { objEmailCampDataContext = new EmailCampDataContext(); lstUserContacts = new List <UserContacts>(); var Select = (from cde in objEmailCampDataContext.spUserContacts_AllActions(null, null, ContactName, Designation, alpha, city, state, country, emailid, null, contactno, FKid, null, null, null, null, "e") select cde).ToList(); if (Select.Count > 0) { lstUserContacts = new List <UserContacts>(); foreach (var item in Select) { objUserContacts = new UserContacts(); objUserContacts.Addressline1 = Convert.ToString(item.Addressline1); objUserContacts.City1 = Convert.ToString(item.City1); objUserContacts.CreatedBy = item.CreatedBy; objUserContacts.CreatedOn = item.CreatedOn; objUserContacts.UpdatedBy = item.UpdatedBy; objUserContacts.UpdatedOn = item.UpdatedOn; objUserContacts.Email_id = item.email_id; objUserContacts.FK_UserID = item.FK_UserID; objUserContacts.ContactName = item.ContactName; objUserContacts.PK_ContactID = Convert.ToInt16(item.PK_ContactID.ToString()); objUserContacts.State1 = item.State1; objUserContacts.ContactNo = item.ContactNo; objUserContacts.Country1 = item.Country1; objUserContacts.Designation = item.Designation; objUserContacts.MailContent = item.MailContent; objUserContacts.DateofBirth = item.DateofBirth; lstUserContacts.Add(objUserContacts); } } objEmailCampDataContext = null; objUserContacts = null; DataSet converted = new DataSet(); if (lstUserContacts.Count > 0) { converted.Tables.Add(ListToDataSet.newTable(lstUserContacts)); return(converted); } else { converted.Tables.Add(ListToDataSet.newTableColumnAlone(lstUserContacts)); return(converted); } }
private void gridcontactsbind() { try { objUserContacts = new UserContacts(); lstUserContacts = new List<UserContacts>(); objBL_UserContacts = new BL_UserContacts(); lstUserContacts = objBL_UserContacts.SelectContactsonSelectedID(Convert.ToInt32(Session["CompanyID"].ToString()), Session["SelectContactID"].ToString()); gvAddContacts.DataSource = lstUserContacts; gvAddContacts.DataBind(); } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("CreateCampign.aspx:gridcontactsbind() - " + ex.Message); } }
public async Task <IActionResult> DeleteConfirmed(string owner, string username) { UserContacts userContacts = await _context.UserContacts.SingleOrDefaultAsync(m => m.owner == owner); JObject currentContacts = userContacts.contacts; currentContacts.Remove(username); userContacts.contacts = currentContacts; _context.Attach(userContacts); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
/// <summary> /// Created By :: Sakthivel.R /// Created On :: 25-4-2015 /// Comments :: Delete duplicate mail id from UserContacts. /// </summary> #region Delete_DuplicateEmailid_Uploading public void DeleteDuplicateEmailidUploading(int Contactlistid, int CreatedBy) { try { objEmailCampDataContext = new EmailCampDataContext(); var Delete = (from cde in objEmailCampDataContext.spUserContacts_AllActions(null, null, null, null, null, null, null, null, null, null, null, CreatedBy, null, null, null, null, "c") select cde).ToList(); Delete = null; objUserContacts = null; objEmailCampDataContext = null; } catch (Exception ex) { ex.ToString(); } }
public async Task <IActionResult> Add(string owner, string username) { UserContacts userContacts = _context.UserContacts.SingleOrDefault(el => (el.owner == owner)); JObject currentContacts = userContacts.contacts; if (currentContacts["username"] == null) { currentContacts.Add(username, username); } userContacts.contacts = currentContacts; _context.Attach(userContacts); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
/// <summary> /// Created By :: Sakthivel.R /// Created On :: 30-3-2015 /// Comments :: Updation function of UserContacts details. /// </summary> #region Update_UserContactsCreation public void UserContactsUpdate(UserContacts objUserContacts) { try { objEmailCampDataContext = new EmailCampDataContext(); var Update = (from cde in objEmailCampDataContext.spUserContacts_AllActions(objUserContacts.PK_ContactID, objUserContacts.FK_UserID, objUserContacts.ContactName, objUserContacts.Designation, objUserContacts.Addressline1, objUserContacts.City1, objUserContacts.State1, objUserContacts.Country1, objUserContacts.Email_id, objUserContacts.MailContent, objUserContacts.ContactNo, objUserContacts.CreatedBy, objUserContacts.CreatedOn, objUserContacts.UpdatedBy, objUserContacts.UpdatedOn, objUserContacts.DateofBirth, "u") select cde).ToList(); Update = null; objUserContacts = null; objEmailCampDataContext = null; } catch (Exception ex) { ex.ToString(); } }
/// <summary> /// Currents the users contacts. /// </summary> /// <returns></returns> public UserContacts CurrentUsersContacts() { try { #region processing UserContacts result = new UserContacts(); string jsonResult = GetRequest(string.Concat(PushbulletConstants.BaseUrl, PushbulletConstants.ContactsUrls.Contacts)); result = JsonSerializer.Deserialize <UserContacts>(jsonResult); return(result); #endregion processing } catch (Exception) { throw; } }
/// <summary> /// Created By :: Sakthivel.R /// Created On :: 30-3-2015 /// Comments :: Updation function of UserContacts details. /// </summary> #region Delete_UserContactsCreation public void UserContactsDelete(int UserContactsid) { try { objEmailCampDataContext = new EmailCampDataContext(); var Delete = (from cde in objEmailCampDataContext.spUserContacts_AllActions(UserContactsid, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "d") select cde).ToList(); Delete = null; objUserContacts = null; objEmailCampDataContext = null; } catch (Exception ex) { ex.ToString(); } }
public async Task <ActionResult <UserContacts> > PostUserContacts(UserContacts userContacts) { _context.UserContacts.Add(userContacts); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (UserContactsExists(userContacts.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetUserContacts", new { id = userContacts.Id }, userContacts)); }
/// <summary> /// Created By :: Sakthivel.R /// Created On :: 30-3-2015 /// Comments :: Select all records for UserContacts details. /// </summary> #region Select_All_Records_CreateUserContacts public List <UserContacts> UserContactsSelectforgrid(int contlistid) { objEmailCampDataContext = new EmailCampDataContext(); lstUserContacts = new List <UserContacts>(); var Select = (from cde in objEmailCampDataContext.spUserContacts_AllActions(contlistid, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "s") select cde).ToList(); if (Select.Count > 0) { lstUserContacts = new List <UserContacts>(); foreach (var item in Select) { objUserContacts = new UserContacts(); objUserContacts.Addressline1 = Convert.ToString(item.Addressline1); objUserContacts.City1 = Convert.ToString(item.City1); objUserContacts.CreatedBy = item.CreatedBy; objUserContacts.CreatedOn = item.CreatedOn; objUserContacts.UpdatedBy = item.UpdatedBy; objUserContacts.UpdatedOn = item.UpdatedOn; objUserContacts.Email_id = item.email_id; objUserContacts.FK_UserID = item.FK_UserID; objUserContacts.ContactName = item.ContactName; objUserContacts.PK_ContactID = Convert.ToInt16(item.PK_ContactID.ToString()); objUserContacts.State1 = item.State1; objUserContacts.ContactNo = item.ContactNo; objUserContacts.Country1 = item.Country1; objUserContacts.Designation = item.Designation; objUserContacts.MailContent = item.MailContent; objUserContacts.DateofBirth = item.DateofBirth; lstUserContacts.Add(objUserContacts); } } objEmailCampDataContext = null; objUserContacts = null; return(lstUserContacts); }
public void AccessUpdateContacts(UserContacts objUserContacts1) { objDL_UserContaxcts.UserContactsUpdate(objUserContacts1); }
/// <summary> /// Created By :: Sakthivel.R /// Created On :: 11-5-2015 /// Comments :: Select records based on checkbox selectedID for UserContacts details. /// </summary> #region Select_Records_Basedon_Selected_ID_UserContacts public List <UserContacts> SelectUserContactsbasedonSelectedID(int FKid, string PKContid) { //objEmailCampDataContext = new EmailCampDataContext(); //lstUserContacts = new List<UserContacts>(); //var Select = (from cde in objEmailCampDataContext.spUserContacts_AllActions(PKContid, FKid, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "p") // select cde).ToList(); //var Select = (from cde in objEmailCampDataContext.EC_UserContacts // where cde.PK_ContactID.ToString().Contains(PKContid) // select cde).ToList(); //if (Select.Count > 0) //{ // lstUserContacts = new List<UserContacts>(); // foreach (var item in Select) // { // objUserContacts = new UserContacts(); // objUserContacts.Addressline1 = Convert.ToString(item.Addressline1); // objUserContacts.City1 = Convert.ToString(item.City1); // objUserContacts.CreatedBy = item.CreatedBy; // objUserContacts.CreatedOn = item.CreatedOn; // objUserContacts.UpdatedBy = item.UpdatedBy; // objUserContacts.UpdatedOn = item.UpdatedOn; // objUserContacts.Email_id = item.email_id; // objUserContacts.FK_UserID = item.FK_UserID; // objUserContacts.ContactName = item.ContactName; // objUserContacts.PK_ContactID = Convert.ToInt16(item.PK_ContactID.ToString()); // objUserContacts.State1 = item.State1; // objUserContacts.ContactNo = item.ContactNo; // objUserContacts.Country1 = item.Country1; // objUserContacts.Designation = item.Designation; // objUserContacts.MailContent = item.MailContent; // objUserContacts.DateofBirth = item.DateofBirth; // lstUserContacts.Add(objUserContacts); // } //} //objEmailCampDataContext = null; //objUserContacts = null; string cs = "Data Source=ARYVARTDOTNET;Integrated Security=true;Initial Catalog=EmailCampaign;User ID=sa;Password=aryvart@2015"; SqlConnection con = new SqlConnection(cs); SqlDataAdapter da = new SqlDataAdapter(); con.Open(); string excelread = "SELECT a.* from EC_UserContacts a inner join dbo.EC_UserLogin b on a.FK_UserID = b.PK_UserID where b.FK_CompanyID = " + FKid + " and PK_ContactID in (" + PKContid + ")"; da.SelectCommand = new SqlCommand(excelread, con); //da.SelectCommand = new SqlCommand("select * from Addresses_Temp1",con); DataTable dt = new DataTable(); //dt.Columns.Add("S No", typeof(int)); //dt.Columns.Add("Name", typeof(string)); //dt.Columns.Add("Email", typeof(string));DBNull.Value ? 0 : da.Fill(dt); lstUserContacts = new List <UserContacts>(); for (int i = 0; i < dt.Rows.Count; i++) { objUserContacts = new UserContacts(); objUserContacts.Addressline1 = Convert.ToString(dt.Rows[i]["Addressline1"]); objUserContacts.City1 = Convert.ToString(dt.Rows[i]["City1"]); if (dt.Rows[i]["CreatedBy"] != DBNull.Value) { objUserContacts.CreatedBy = Convert.ToInt16(dt.Rows[i]["CreatedBy"]); } if (dt.Rows[i]["CreatedOn"] != DBNull.Value) { objUserContacts.CreatedOn = Convert.ToDateTime(dt.Rows[i]["CreatedOn"]); } if (dt.Rows[i]["UpdatedBy"] != DBNull.Value) { //if(dt.Rows[i]["UpdatedBy"].ToString() !="") objUserContacts.UpdatedBy = Convert.ToInt16(dt.Rows[i]["UpdatedBy"]); } if (dt.Rows[i]["UpdatedOn"] != DBNull.Value) { objUserContacts.UpdatedOn = Convert.ToDateTime(dt.Rows[i]["UpdatedOn"]); } if (dt.Rows[i]["email_id"] != DBNull.Value) { //if (dt.Rows[i]["email_id"] != "") objUserContacts.Email_id = dt.Rows[i]["email_id"].ToString(); } if (dt.Rows[i]["FK_UserID"] != DBNull.Value) { //if(dt.Rows[i]["FK_UserID"] != "") objUserContacts.FK_UserID = Convert.ToInt16(dt.Rows[i]["FK_UserID"]); } objUserContacts.ContactName = dt.Rows[i]["ContactName"].ToString(); if (dt.Rows[i]["PK_ContactID"] != DBNull.Value) { objUserContacts.PK_ContactID = Convert.ToInt16(dt.Rows[i]["PK_ContactID"].ToString()); } objUserContacts.State1 = dt.Rows[i]["State1"].ToString(); objUserContacts.ContactNo = dt.Rows[i]["ContactNo"].ToString(); objUserContacts.Country1 = dt.Rows[i]["Country1"].ToString(); objUserContacts.Designation = dt.Rows[i]["Designation"].ToString(); objUserContacts.MailContent = dt.Rows[i]["MailContent"].ToString(); if (dt.Rows[i]["DateofBirth"] != DBNull.Value) { if (dt.Rows[i]["DateofBirth"] != "") { objUserContacts.DateofBirth = Convert.ToDateTime(dt.Rows[i]["DateofBirth"].ToString()); } } lstUserContacts.Add(objUserContacts); } con.Close(); return(lstUserContacts); }
//public void AccessExcelDataStore() //{ // objDL_UserContaxcts.UserContactsExcelInsert(); //} public void AccessInsertContacts(UserContacts objUserContacts1) { objDL_UserContaxcts.UserContactsInsert(objUserContacts1); }
/// <summary> /// Created By :: Sakthivel.R /// Created On :: 21-5-2015 /// Comments :: Inserting all values of contact form. /// </summary> protected void btnSubmit_Click(object sender, EventArgs e) { try { objUserContacts = new UserContacts(); lstListContacts = new List <ListContacts>(); objUserContacts.FK_UserID = Convert.ToInt32(Session["UserID"].ToString()); objUserContacts.Designation = Designation.Value.ToString().Trim(); objUserContacts.Email_id = EmailID.Value.ToString().Trim(); objUserContacts.ContactName = txtCampaignName.Value.ToString().Trim(); objUserContacts.Addressline1 = Address.Value.ToString().Trim(); objUserContacts.City1 = City.Value.ToString().Trim(); objUserContacts.State1 = State.Value.ToString().Trim(); objUserContacts.Country1 = Country.Value.ToString().Trim(); objUserContacts.ContactNo = ContactNo.Value.ToString().Trim(); if (dtScheduledatetime.Value != string.Empty) { //DateTime dt = Convert.ToDateTime(dtScheduledatetime.Value.ToString()); //String.Format("{0:dd/MM/yyyy}", dt); objUserContacts.DateofBirth = Convert.ToDateTime(dtScheduledatetime.Value); } if (Request.QueryString["CntId"] != null) { objUserContacts.PK_ContactID = Convert.ToInt32(Request.QueryString["CntId"].ToString()); objUserContacts.UpdatedBy = Convert.ToInt32(Session["UserID"].ToString()); objUserContacts.UpdatedOn = DateTime.Now; lstUserContacts = objBL_UserContacts.SelectUserContactsListforgrid(Convert.ToInt16(HttpUtility.UrlDecode(Request.QueryString["CntId"]).ToString())); if (lstUserContacts.Count > 0) { if (lstUserContacts[0].FK_UserID != null) { objUserContacts.FK_UserID = lstUserContacts[0].FK_UserID; } if (lstUserContacts[0].MailContent != null) { objUserContacts.MailContent = lstUserContacts[0].MailContent; } if (lstUserContacts[0].CreatedOn != null) { objUserContacts.CreatedOn = lstUserContacts[0].CreatedOn; } if (lstUserContacts[0].CreatedBy != null) { objUserContacts.CreatedBy = lstUserContacts[0].CreatedBy; } } objBL_UserContacts.AccessUpdateContacts(objUserContacts); } else { objUserContacts.CreatedOn = DateTime.Now; objUserContacts.CreatedBy = Convert.ToInt32(Session["UserID"].ToString()); objBL_UserContacts.AccessInsertContacts(objUserContacts); } objUserContacts = null; ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "Clearuserinput1();", true); } catch (Exception ex) { New_EmailCampaign.App_Code.GlobalFunction.StoreLog("ContactsAdd.aspx:btnSubmit_Click() - " + ex.Message); } }