Exemplo n.º 1
0
    public DataSet GetSelectData(string storedprocedure, DataIUD[] IUD)
    {
        DataSet dt  = new DataSet();
        DataIUD emp = new DataIUD();
        //string con = ConfigurationManager.ConnectionStrings["empConnectionString"].ToString();

        string cn = ConfigurationManager.ConnectionStrings["esspconnection"].ToString();

        using (SqlConnection sqlCon = new SqlConnection(cn))    //"Data Source=.;Initial Catalog=Employee;User ID=sa;Password=admin123"))
        {
            SqlCommand cmd = new SqlCommand();
            sqlCon.Open();
            cmd.Connection = sqlCon;

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = storedprocedure;
            //cmd.Parameters.Add("@empno", SqlDbType.Int).Value =4;
            //cmd.Parameters.Add("@empname", SqlDbType.VarChar,200 ).Value = "bb";
            //cmd.Parameters.Add("@age", SqlDbType.Int).Value = 24;


            //using (SqlCommand sqlCom = new SqlCommand(storedprocedure, sqlCon))
            //{
            //    sqlCon.Open();
            for (int i = 0; i < IUD.Length; i++)
            {
                cmd.Parameters.Add(IUD[i].Paraname, IUD[i].Paratype);
                cmd.Parameters[i].Value = IUD[i].Paravalue;
            }



            SqlDataAdapter sda = new SqlDataAdapter();


            sda.SelectCommand = cmd;

            sda.Fill(dt);



            //    sqlCom.ExecuteNonQuery();

            //}
        }
        //return IUD[0].Paraname;
        //return result.ToString();
        return(dt);
    }
Exemplo n.º 2
0
    public string GetInsertUpdateData(string storedprocedure, DataIUD[] IUD)
    {
        int     result;
        DataIUD emp = new DataIUD();
        //string con = ConfigurationManager.ConnectionStrings["empConnectionString"].ToString();

        string cn = ConfigurationManager.ConnectionStrings["ConnectionString_master"].ToString();

        using (SqlConnection sqlCon = new SqlConnection(cn))    //"Data Source=.;Initial Catalog=Employee;User ID=sa;Password=admin123"))
        {
            SqlCommand cmd = new SqlCommand();
            sqlCon.Open();
            cmd.Connection = sqlCon;

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = storedprocedure;
            //cmd.Parameters.Add("@empno", SqlDbType.Int).Value =4;
            //cmd.Parameters.Add("@empname", SqlDbType.VarChar,200 ).Value = "bb";
            //cmd.Parameters.Add("@age", SqlDbType.Int).Value = 24;


            //using (SqlCommand sqlCom = new SqlCommand(storedprocedure, sqlCon))
            //{
            //    sqlCon.Open();
            for (int i = 0; i < IUD.Length; i++)
            {
                cmd.Parameters.Add(IUD[i].Paraname, IUD[i].Paratype);
                cmd.Parameters[i].Value = IUD[i].Paravalue;
            }
            result = cmd.ExecuteNonQuery();
            sqlCon.Close();
            //    sqlCom.ExecuteNonQuery();

            //}
        }
        //return IUD[0].Paraname;
        return(result.ToString());
    }
    public static String save_rec(String fname, String lname, String email, String place, String spl)
    {
        Service webins = new Service();

        DataIUD[] sqlparam = new DataIUD[5];
        sqlparam[0]           = new DataIUD();
        sqlparam[0].Paratype  = "SqlDbType.nvarchar";
        sqlparam[0].Paraname  = "@fname";
        sqlparam[0].Paravalue = fname;

        sqlparam[1]           = new DataIUD();
        sqlparam[1].Paratype  = "SqlDbType.nvarchar";
        sqlparam[1].Paraname  = "@lname";
        sqlparam[1].Paravalue = lname;

        sqlparam[2]           = new DataIUD();
        sqlparam[2].Paratype  = "SqlDbType.nvarchar";
        sqlparam[2].Paraname  = "@email";
        sqlparam[2].Paravalue = email;

        sqlparam[3]           = new DataIUD();
        sqlparam[3].Paratype  = "SqlDbType.nvarchar";
        sqlparam[3].Paraname  = "@place";
        sqlparam[3].Paravalue = place;
        sqlparam[4]           = new DataIUD();
        sqlparam[4].Paratype  = "SqlDbType.nvarchar";
        sqlparam[4].Paraname  = "@specialization";
        sqlparam[4].Paravalue = spl;
        DataSet dss = webins.GetSelectData("WebinarRegister", sqlparam);
        String  msg = dss.Tables[0].Rows[0][0].ToString();

        // MailMessage Msg = new MailMessage();
        // Sender e-mail address.


        //Msg.From = new MailAddress("*****@*****.**","MENDINE MARKETING TEAM");
        // Recipient e-mail address.

        // Msg.To.Add(email);
        // Msg.Subject = "Webinar Invitation";
        // Msg.IsBodyHtml = true;
        // Msg.Body = "Dear Sir/Ma’am,  <br /> <br />" +
        //  "<b>Greeting from Mendine Pharmaceuticals Pvt. Ltd.!! </b>" +

//" <br /> <br />We would like to invite you to our <b> “Marketing Review Meeting” </b> on 16th July 2020. <br /> <br />" +

//"Timing : 4:00 PM.<br/><br/>" +


//"<table ><tr><td></td><td><a href=https://meet.google.com/red-pcjb-hvt>meet.google.com/red-pcjb-hvt</a></td></tr></table>";

//"<a href='meet.google.com/red-pcjb-hvt'> meet.google.com/red-pcjb-hvt</a>";
        // your remote SMTP server IP.
        // SmtpClient smtp = new SmtpClient();
        // smtp.Host = "smtp.gmail.com";
        // smtp.Port = 587;
        // smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "MIS2020_IECS@#");//("*****@*****.**", "saf@2014");
        //  smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "KOLKATA700091");//("*****@*****.**", "saf@2014");
        // smtp.EnableSsl = true;
        // smtp.Send(Msg);



        return(msg);
    }