コード例 #1
0
 public void gridshow()
 {
     //SqlDataAdapter da = new SqlDataAdapter("teacher_dlt_proc", con);
     //da.SelectCommand.CommandType = CommandType.StoredProcedure;
     //da.SelectCommand.Parameters.AddWithValue("@action", "show");
     //da.SelectCommand.Parameters.AddWithValue("@teacher_id", "");
     //DataTable dt = new DataTable();
     //da.Fill(dt);
     teacherservice.teachersev obj = new teacherservice.teachersev();
     GridView1.DataSource = obj.show();
     GridView1.DataBind();
 }
コード例 #2
0
    protected void submit_btn_Click(object sender, EventArgs e)
    {
        con.Open();
        SqlCommand    cmd1 = new SqlCommand("Select * from salary_tbl where teacher_tid='" + tid_ddl.SelectedItem.ToString() + "' and teacher_name='" + name_ddl.SelectedItem.ToString() + "'and year='" + year_txt.Text + "'and month='" + month_ddl.SelectedItem.ToString() + "'", con);
        SqlDataReader dr   = cmd1.ExecuteReader();

        if (dr.Read())
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Salary already Paid!!!!');", true);
            blank();
            dr.Close();
        }
        else
        {
            dr.Close();
            DateTime currentdate = DateTime.Now;
            string   date        = currentdate.ToString("dd/MM/yyyy");
            //SqlCommand cmd = new SqlCommand("salary_proc", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.AddWithValue("@action", "insert");
            //cmd.Parameters.AddWithValue("@pk_id", "");
            //cmd.Parameters.AddWithValue("@teacher_name", name_ddl.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@teacher_tid", tid_ddl.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@year", year_txt.Text);
            //cmd.Parameters.AddWithValue("@month", month_ddl.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@date", (DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture)).ToShortDateString());
            //cmd.Parameters.AddWithValue("@salary", salary_txt.Text);
            //cmd.Parameters.AddWithValue("@holiday", holiday_txt.Text);
            //cmd.Parameters.AddWithValue("@paid", paidsalary_txt.Text);
            //cmd.ExecuteNonQuery();
            teacherservice.teachersev obj = new teacherservice.teachersev();
            int a = obj.teacherpayinsert(name_ddl.SelectedItem.ToString(), tid_ddl.SelectedItem.ToString(), year_txt.Text, month_ddl.SelectedItem.ToString(), (DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture)).ToShortDateString(), salary_txt.Text, holiday_txt.Text, paidsalary_txt.Text);
            if (a > 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Salary Submitted Successfully!!!!');", true);
                blank();
            }
        }
        con.Close();
    }
コード例 #3
0
    protected void btn_delete_Click(object sender, EventArgs e)
    {
        con.Open();
        LinkButton  lnk = (LinkButton)sender;
        GridViewRow row = (GridViewRow)lnk.NamingContainer;
        Label       l1  = (Label)row.FindControl("Lbl_id");

        //SqlCommand cmd = new SqlCommand("teacher_dlt_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "delete");
        //cmd.Parameters.AddWithValue("@teacher_id", l1.Text);
        //cmd.ExecuteNonQuery();
        teacherservice.teachersev obj = new teacherservice.teachersev();
        int a = obj.delete(Convert.ToInt32(l1.Text));

        if (a > 0)
        {
            gridshow();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Deleted!!!!');", true);
        }

        con.Close();
    }
コード例 #4
0
    protected void submit_btn_Click(object sender, EventArgs e)
    {
        string senderusername;

        senderusername = Label9.Text;
        string senderpassword;

        senderpassword = Label10.Text;
        string senderid;

        senderid = Label11.Text;
        con.Open();
        SqlCommand    com = new SqlCommand("select * from teacher_info where teacher_name='" + name_txt.Text + "' and father_name='" + father_txt.Text + "' and email='" + email_txt.Text + "'", con);
        SqlDataReader dr  = com.ExecuteReader();

        if (dr.Read())
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Record Exist Already!!!!');", true);

            dr.Close();
        }
        else
        {
            dr.Close();
            string imgg = "";
            if (teacher_img.HasFile)
            {
                imgg = ("~/img/" + teacher_img.FileName);
                teacher_img.SaveAs(Server.MapPath("~/img/") + teacher_img.FileName);
            }
            //SqlCommand cmd = new SqlCommand("teacher_proc", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.AddWithValue("@action", "insert");
            //cmd.Parameters.AddWithValue("@teacher_id", "");
            //cmd.Parameters.AddWithValue("@teacher_no", teacherno_txt.Text);
            //cmd.Parameters.AddWithValue("@joining_date", joindate_txt.Text);
            //cmd.Parameters.AddWithValue("@teacher_name", name_txt.Text);
            //cmd.Parameters.AddWithValue("@designation", Text_designation.Text);
            //cmd.Parameters.AddWithValue("@father_name", father_txt.Text);
            //cmd.Parameters.AddWithValue("@gender", gender_ddl.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@dob", dob_txt.Text);
            //cmd.Parameters.AddWithValue("@country", ddl_country.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@state", ddl_state.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@city", ddl_city.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@address1", addres1_txt.Text);
            //cmd.Parameters.AddWithValue("@mobile", mob_txt.Text);
            //cmd.Parameters.AddWithValue("@email", email_txt.Text);
            //cmd.Parameters.AddWithValue("@maritial_status", martial_ddl.SelectedItem.ToString());
            //cmd.Parameters.AddWithValue("@blood_group", blood_txt.Text);
            //cmd.Parameters.AddWithValue("@total_exp_year", exyear_txt.Text);
            //cmd.Parameters.AddWithValue("@total_exp_month", exmonth_txt.Text);
            //cmd.Parameters.AddWithValue("@experience_detail", exdetail_txt.Text);
            //cmd.Parameters.AddWithValue("@salary", salary_txt.Text);

            //Random ran = new Random();
            //int i = ran.Next(1, 9);
            //int j = i * 289;
            //pass = "******" + j + "ER";
            //cmd.Parameters.AddWithValue("@password", pass);
            //Random ran1 = new Random();
            //int k = ran1.Next(1, 5);
            //int l = k * 256;
            //pass1 = "TE" + l + "LE";
            //cmd.Parameters.AddWithValue("@teacher_tid", pass1);
            //cmd.Parameters.AddWithValue("@image", imgg);
            //cmd.Parameters.AddWithValue("@type", "teacher");
            teacherservice.teachersev obj = new teacherservice.teachersev();
            int a = obj.insert(teacherno_txt.Text, joindate_txt.Text, name_txt.Text, Text_designation.Text, father_txt.Text, gender_ddl.SelectedItem.ToString(), dob_txt.Text, ddl_country.SelectedItem.ToString(),
                               ddl_state.SelectedItem.ToString(), ddl_city.SelectedItem.ToString(), addres1_txt.Text, mob_txt.Text, email_txt.Text, martial_ddl.SelectedItem.ToString(),
                               blood_txt.Text, exyear_txt.Text, exmonth_txt.Text, exdetail_txt.Text, salary_txt.Text, pass, pass1, imgg, "teacher");
            if (a > 0)
            {
                var smtp = new System.Net.Mail.SmtpClient();
                {
                    smtp.Host        = "smtp.gmail.com";
                    smtp.Port        = 587;
                    smtp.EnableSsl   = true;
                    smtp.Credentials = new NetworkCredential("*****@*****.**".ToString(), "my1234567".ToString());
                }
                smtp.Send("*****@*****.**".ToString(), email_txt.Text, "Message".ToString(), "Your Loginid:-  " + email_txt.Text + "\r\n" + "Your Password:-  " + pass + "\r\n" + "Teacher id:- " + pass1);
                //System.Net.Mail.MailMessage mail = new MailMessage();
                //mail.From = new MailAddress("*****@*****.**");
                //mail.To.Add(email_txt.Text);
                //mail.Subject = "Login Id Details";
                //mail.Body = "<html><head><title>Login Id Details:</title></head><body><div><br/><br/><p>Your Loginid:" + email_txt.Text + "<br/>Your Password:-" + pass + "<br/>" + "Teacher id:-" + pass1 + "<br/> </div></body></Html>";
                //mail.IsBodyHtml = true;
                //SmtpClient smtp = new SmtpClient();
                //smtp.Host = "relay-hosting.secureserver.net";
                //smtp.Port = 25;
                //smtp.EnableSsl = false;
                //smtp.Send(mail);
                //cmd.ExecuteNonQuery();

                string       sURL;
                string       message1 = "Thanks For Registration" + "\n\n" + "Email:" + email_txt.Text + "\n\n" + "Password:"******"\n" + "Teacher_ID:" + pass1 + "\n";
                StreamReader objReader;

                sURL = "http://pointsms.in/API/sms.php?username="******"&password="******"&from=" + senderid + "&to=" + mob_txt.Text + "&msg=" + message1;

                WebRequest wrGETURL;
                wrGETURL = WebRequest.Create(sURL);
                try
                {
                    Stream objStream;
                    objStream = wrGETURL.GetResponse().GetResponseStream();
                    objReader = new StreamReader(objStream);
                    objReader.Close();
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Thanks For Registartion!!!!');", true);

                gridshow();
                blank();
            }
        }
        con.Close();
    }
コード例 #5
0
    protected void upd_btn_Click(object sender, EventArgs e)
    {
        con.Open();

        string imgg = "";

        if (teacher_img.HasFile)
        {
            imgg = ("~/img/" + teacher_img.FileName);
            teacher_img.SaveAs(Server.MapPath("~/img/") + teacher_img.FileName);
        }
        else
        {
            imgg = Image2.ImageUrl;
        }


        //SqlCommand cmd = new SqlCommand("teacher_proc", con);
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@action", "update");
        //cmd.Parameters.AddWithValue("@teacher_id", Label_id.Text);
        //cmd.Parameters.AddWithValue("@teacher_no", teacherno_txt.Text);
        //cmd.Parameters.AddWithValue("@joining_date", joindate_txt.Text);
        //cmd.Parameters.AddWithValue("@teacher_name", name_txt.Text);
        //cmd.Parameters.AddWithValue("@designation", Text_designation.Text);
        //cmd.Parameters.AddWithValue("@father_name", father_txt.Text);
        //cmd.Parameters.AddWithValue("@gender", gender_ddl.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@dob", dob_txt.Text);
        //cmd.Parameters.AddWithValue("@country", ddl_country.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@state",ddl_state.SelectedItem.ToString() );
        //cmd.Parameters.AddWithValue("@city", ddl_city.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@address1", addres1_txt.Text);
        //cmd.Parameters.AddWithValue("@mobile", mob_txt.Text);
        //cmd.Parameters.AddWithValue("@email", email_txt.Text);
        //cmd.Parameters.AddWithValue("@maritial_status", martial_ddl.SelectedItem.ToString());
        //cmd.Parameters.AddWithValue("@blood_group", blood_txt.Text);
        //cmd.Parameters.AddWithValue("@total_exp_year", exyear_txt.Text);
        //cmd.Parameters.AddWithValue("@total_exp_month", exmonth_txt.Text);
        //cmd.Parameters.AddWithValue("@experience_detail", exdetail_txt.Text);
        //cmd.Parameters.AddWithValue("@salary", salary_txt.Text);
        //cmd.Parameters.AddWithValue("@password", lbl_pass.Text);
        //cmd.Parameters.AddWithValue("@teacher_tid", lbl_tid.Text);
        //cmd.Parameters.AddWithValue("@image", imgg);
        //cmd.Parameters.AddWithValue("@type", "teacher");
        //cmd.ExecuteNonQuery();
        teacherservice.teachersev obj = new teacherservice.teachersev();
        int a = obj.update(Convert.ToInt32(Label_id.Text), teacherno_txt.Text, joindate_txt.Text, name_txt.Text, Text_designation.Text, father_txt.Text, gender_ddl.SelectedItem.ToString(), dob_txt.Text, ddl_country.SelectedItem.ToString(),
                           ddl_state.SelectedItem.ToString(), ddl_city.SelectedItem.ToString(), addres1_txt.Text, mob_txt.Text, email_txt.Text, martial_ddl.SelectedItem.ToString(),
                           blood_txt.Text, exyear_txt.Text, exmonth_txt.Text, exdetail_txt.Text, salary_txt.Text, lbl_pass.Text, lbl_tid.Text, imgg, "teacher");

        if (a > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Updated!!!!');", true);

            gridshow();
            blank();
            clr_btn.Visible    = true;
            upd_btn.Visible    = false;
            submit_btn.Visible = true;
            Image2.Visible     = false;
        }
        con.Close();
    }