Exemplo n.º 1
0
        public List <StudentInfoObj> GetAllStudentInfo()
        {
            List <StudentInfoObj> studentinfolist = null;


            //Lets get the list of all employees in a datataable
            using (DataTable table = SqlDBHelper.ExecuteSelectCommand("GetStudentAll", CommandType.StoredProcedure))
            {
                //check if any record exist or not
                if (table.Rows.Count > 0)
                {
                    //Lets go ahead and create the list of employees
                    studentinfolist = new List <StudentInfoObj>();

                    //Now lets populate the employee details into the list of employees
                    foreach (DataRow row in table.Rows)
                    {
                        StudentInfoObj stuinfo = new StudentInfoObj();

                        stuinfo.Name            = row["Name"].ToString();
                        stuinfo.ID              = (row["ID"]).ToString();
                        stuinfo.Dept            = row["Dept"].ToString();
                        stuinfo.Gender          = Convert.ToChar(row["Gender"]);
                        stuinfo.Completedcredit = Convert.ToInt32(row["CompletedCredit"]);
                        stuinfo.Semester        = Convert.ToInt32(row["Semester"]);
                        stuinfo.Cgpa            = float.Parse(row["Cgpa"].ToString());
                        stuinfo.Password        = Convert.ToString(row["Password"]);

                        studentinfolist.Add(stuinfo);
                    }
                }
            }

            return(studentinfolist);
        }
        public List <Daneshkade> GetAllDaneshkade()
        {
            List <Daneshkade> danlist = null;

            using (DataTable table = SqlDBHelper.ExecuteSelectCommand("[Resource_Control].[DaneshkadesSelectAll]", CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    danlist = new List <Daneshkade>();

                    foreach (DataRow row in table.Rows)
                    {
                        Daneshkade danesh = new Daneshkade();
                        danesh.ID         = Convert.ToInt32(row["ID"]);
                        danesh.NameDanesh = row["namedanesh"] as string;
                        danlist.Add(danesh);
                    }
                }
            }

            return(danlist);
        }
Exemplo n.º 3
0
    private void SendHtmlFormattedEmail(string TicketId, string body)
    {
        dt = new DataTable();
        //dt = objTicket.GetLeadEmails(Convert.ToInt32(lblTeam.Text));
        using (MailMessage mailMessage = new MailMessage())
        {
            SmtpClient smtp = new SmtpClient();
            // mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(new MailAddress("*****@*****.**"));
            //mailMessage.To.Add(new MailAddress("*****@*****.**"));

            DataTable dtLocation = new DataTable();

            dtLocation = objSqlDBHelper.ExecuteSelectCommand("SELECT top 1 dbo.RTM_Team_List.T_Location "
                                                             + " FROM            dbo.RTM_User_List INNER JOIN "
                                                             + "    dbo.RTM_Team_List ON dbo.RTM_User_List.UL_Team_Id = dbo.RTM_Team_List.T_ID "
                                                             + " WHERE        (dbo.RTM_User_List.UL_Employee_Id = '" + lblEmpId.Text + "')", CommandType.Text);

            if (dtLocation.Rows.Count > 0)
            {
                if (dtLocation.Rows[0][0].ToString() != "IND" & dtLocation.Rows[0][0].ToString() != "CHN")
                {
                    mailMessage.To.Add(new MailAddress("*****@*****.**"));
                }
            }



            if (string.IsNullOrEmpty(lblEmail.Text) == false)
            {
                mailMessage.CC.Add(new MailAddress(lblEmail.Text));
            }


            //if (dt.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        if (string.IsNullOrEmpty(dr["UL_EmailId"].ToString()) == false)
            //        {
            //            mailMessage.CC.Add(new MailAddress(dr["UL_EmailId"].ToString()));
            //        }
            //    }
            //}

            if (Session["access"].ToString() == "4")
            {
                if (string.IsNullOrEmpty(lblRptMgrEmail.Text.ToString().Trim()) == false)
                {
                    mailMessage.CC.Add(new MailAddress(lblRptMgrEmail.Text.ToString().Trim()));
                }
            }

            if (ddlStatus.SelectedItem.Text == "Closed")
            {
                mailMessage.Subject = "RTM Tickets: Ticket # " + TicketId + " is Closed by user " + lblUser.Text;
            }
            else if (ddlStatus.SelectedItem.Text == "Re-Open")
            {
                mailMessage.Subject = "RTM Tickets: Ticket # " + TicketId + " is Re-Opened by user " + lblUser.Text;
            }
            else
            {
                mailMessage.Subject = "RTM Tickets: Ticket # " + TicketId + " is Modified by user " + lblUser.Text;
            }

            mailMessage.Body       = body;
            mailMessage.IsBodyHtml = true;

            smtp.Port = 25;
            smtp.Host = "10.0.5.104";
            //smtp.Host = "outlook-south.tangoe.com";
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.EnableSsl      = false;
            smtp.Send(mailMessage);
        }
    }