예제 #1
0
        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);
        }
예제 #2
0
        public IHttpActionResult InsertEmail(EmailMaster emails)
        {
            bool status = _serverManager.InsertEmail(emails);

            if (status == false)
            {
                return(NotFound());
            }
            return(Ok(status));
        }
예제 #3
0
        public IHttpActionResult GetEmailMaster(int id)
        {
            EmailMaster emailMasters = _emailMasterManager.GetEmailMaster(id);

            if (emailMasters == null)
            {
                return(NotFound());
            }
            return(Ok(emailMasters));
        }
예제 #4
0
        public bool InsertEmailMaster(EmailMaster email)
        {
            bool status = false;

            db.EmailMasters.Add(email);
            if (db.SaveChanges() > 0)
            {
                status = true;
            }
            return(status);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
 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);
 }
예제 #8
0
        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));
        }
예제 #9
0
        public EmailMaster GetEmailMaster(int id)
        {
            EmailMaster email = db.EmailMasters.Find(id);

            return(email);
        }
예제 #10
0
        public IHttpActionResult UpdateEmailMaster(EmailMaster email)
        {
            bool status = _emailMasterManager.UpdateEmailMaster(email);

            return(Ok(status));
        }
예제 #11
0
        public IHttpActionResult InsertEmailMaster(EmailMaster email)
        {
            bool status = _emailMasterManager.InsertEmailMaster(email);

            return(Ok(status));
        }
예제 #12
0
        public bool UpdateEmailMaster(EmailMaster email)
        {
            bool status = _emailMasterRepository.UpdateEmailMaster(email);

            return(status);
        }
예제 #13
0
        public bool InsertEmailMaster(EmailMaster email)
        {
            bool status = _emailMasterRepository.InsertEmailMaster(email);

            return(status);
        }
예제 #14
0
        public EmailMaster GetEmailMaster(int id)
        {
            EmailMaster email = _emailMasterRepository.GetEmailMaster(id);

            return(email);
        }
예제 #15
0
        public bool InsertEmail(EmailMaster emailMaster)
        {
            bool status = _serverCredentialDataRepository.InsertEmail(emailMaster);

            return(status);
        }