public EmailMaster EmailCredentials() { CemexDb con = new CemexDb(); SqlConnection conn = con.GetConnection(); conn.Open(); SqlCommand cmd = new SqlCommand("dbo.proc_GetEmailMaster_Credetials", conn); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(); EmailMaster email = new EmailMaster(); if (reader.HasRows) { while (reader.Read()) { email.Email = reader["email"].ToString(); email.Password = reader["pswd"].ToString(); email.SMTP = reader["smtp"].ToString(); email.Pop = reader["pop"].ToString(); email.Port = Convert.ToInt32(reader["port"]); } conn.Close(); } return(email); }
public IHttpActionResult InsertEmail(EmailMaster emails) { bool status = _serverManager.InsertEmail(emails); if (status == false) { return(NotFound()); } return(Ok(status)); }
public IHttpActionResult GetEmailMaster(int id) { EmailMaster emailMasters = _emailMasterManager.GetEmailMaster(id); if (emailMasters == null) { return(NotFound()); } return(Ok(emailMasters)); }
public bool InsertEmailMaster(EmailMaster email) { bool status = false; db.EmailMasters.Add(email); if (db.SaveChanges() > 0) { status = true; } return(status); }
public bool DeleteEmailMaster(int id) { bool status = false; EmailMaster email = db.EmailMasters.Find(id); db.EmailMasters.Remove(email); if (db.SaveChanges() > 0) { status = true; } return(status); }
public bool UpdateEmailMaster(EmailMaster email) { bool status = false; EmailMaster temp = db.EmailMasters.Where(x => x.EmailMasterId == email.EmailMasterId).AsNoTracking().FirstOrDefault(); db.Entry(email).State = EntityState.Modified; if (db.SaveChanges() > 0) { status = true; } return(status); }
public EmailMaster[] GetAdminEmails() { EmailMaster[] admins = new EmailMaster[] { }; try { admins = (from e in MangContext.EmailMasters where e.ADMIN == true select e).ToArray(); } catch (Exception ex) { ErrorFlag = true; ErrorMessage = ex.Message; } return(admins); }
public async Task <ActionResult> EditEmailMaster(int id) { string token = Session["UserToken"].ToString(); string address = "api/EmailMaster/GetEmailMaster?id=" + id.ToString(); EmailMaster email = new EmailMaster(); HttpResponseMessage Res = await Helpers.Get(address, token); if (Res.IsSuccessStatusCode) { var MainMEnuResponse = Res.Content.ReadAsStringAsync().Result; email = JsonConvert.DeserializeObject <EmailMaster>(MainMEnuResponse); } string address1; List <Organization> orgs = new List <Organization>(); if (Session["Role"].ToString() == "Admin") { address1 = "api/Organizations/GetAllOrganization"; Res = await Helpers.Get(address1, token); if (Res.IsSuccessStatusCode) { var OrgResponse = Res.Content.ReadAsStringAsync().Result; orgs = JsonConvert.DeserializeObject <List <Organization> >(OrgResponse); } } else { id = Convert.ToInt32(Session["Organization"].ToString()); address1 = "api/Organizations/GetOrganization?OrganisationId=" + id.ToString(); Res = await Helpers.Get(address1, token); if (Res.IsSuccessStatusCode) { var OrgResponse = Res.Content.ReadAsStringAsync().Result; Organization organization = new Organization(); organization = JsonConvert.DeserializeObject <Organization>(OrgResponse); orgs.Add(organization); } } ViewBag.Organizations = orgs; return(PartialView(email)); }
public EmailMaster GetEmailMaster(int id) { EmailMaster email = db.EmailMasters.Find(id); return(email); }
public IHttpActionResult UpdateEmailMaster(EmailMaster email) { bool status = _emailMasterManager.UpdateEmailMaster(email); return(Ok(status)); }
public IHttpActionResult InsertEmailMaster(EmailMaster email) { bool status = _emailMasterManager.InsertEmailMaster(email); return(Ok(status)); }
public bool UpdateEmailMaster(EmailMaster email) { bool status = _emailMasterRepository.UpdateEmailMaster(email); return(status); }
public bool InsertEmailMaster(EmailMaster email) { bool status = _emailMasterRepository.InsertEmailMaster(email); return(status); }
public EmailMaster GetEmailMaster(int id) { EmailMaster email = _emailMasterRepository.GetEmailMaster(id); return(email); }
public bool InsertEmail(EmailMaster emailMaster) { bool status = _serverCredentialDataRepository.InsertEmail(emailMaster); return(status); }