Wednesday, July 25, 2018

how to calculate your authorized for put vote | sradha webcreations

how to calculate your authorized for put vote  in asp.net 

AUTHORIZATON FOR VOTE

ENTER NAME


ENTER AGE


ALLOW FOR VOTE


 SAVE


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;


public partial class vote : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void TextBoxAGE_TextChanged(object sender, EventArgs e)
    {
        string sName = TextBoxNAME.Text;
        int iAge = Convert.ToInt32(TextBoxAGE.Text);
        if (iAge > 18)
        {
           // Label1.Text = "you can give vote";
            TextBox1.Text = "you can give vote";
        }
        else
        {
            //Label1.Text = "you cannot give vote";
            TextBox1.Text = "you cannot give vote";
        }
    }



news paper advisement calculation | sradha webcreations

News paper advisement calculation 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void TOTAL_Click(object sender, EventArgs e)
    {
        string sNewPaperName;
        string sDate;
        string sFirmName;
        float fHeight;
        float fWidth;
        float fSqCm;
        float fPerSqCm;
        float Ftotal;

        sNewPaperName = TextBoxPAPER.Text;
        sDate = TextBoxDATE.Text;
        sFirmName = TextBoxFIRM.Text;
       
        fHeight = Convert.ToInt32(TextBoxHEIGHT.Text);
        fWidth = Convert.ToInt32(TextBoxWIDTH.Text);
       
        fSqCm = fHeight * fWidth;
        TextBoxSQ.Text = Convert.ToString(fSqCm);

        fSqCm = Convert.ToInt32(TextBoxSQ.Text);
        fPerSqCm = Convert.ToInt32(TextBoxPERSQ.Text);   
        Ftotal = fPerSqCm * fSqCm;
        TextBoxTOTAL.Text = Convert.ToString(Ftotal);
    }
    protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string connectionstring = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;

        string insertsql = "insert into advertisement(newpaper,date,firmname,width,height,sqcm,persqcm,total)values(@newpaper,@date,@firmname,@width,@height,@sqcm,@persqcm,@total)";
        using (SqlConnection myconnection = new SqlConnection(connectionstring))
        {
            myconnection.Open();
  SqlCommand mycommand = new SqlCommand(insertsql,myconnection);
            mycommand.Parameters.AddWithValue("@newpaper",TextBoxPAPER.Text);
            mycommand.Parameters.AddWithValue("@date",TextBoxDATE.Text);
            mycommand.Parameters.AddWithValue("@firmname",TextBoxFIRM.Text);
            mycommand.Parameters.AddWithValue("@width",TextBoxWIDTH.Text);
            mycommand.Parameters.AddWithValue("@height",TextBoxHEIGHT.Text);  mycommand.Parameters.AddWithValue("@sqcm",TextBoxSQ.Text);
            mycommand.Parameters.AddWithValue("@persqcm",TextBoxPERSQ.Text);
            mycommand.Parameters.AddWithValue("@total",TextBoxTOTAL.Text);

            mycommand.ExecuteNonQuery();
            myconnection.Close();
        }
        TextBoxPAPER.Text = string.Empty;
        TextBoxDATE.Text = string.Empty;
        TextBoxFIRM.Text = string.Empty;
        TextBoxWIDTH.Text = string.Empty;
        TextBoxHEIGHT.Text = string.Empty;
        TextBoxSQ.Text = string.Empty;
        TextBoxPERSQ.Text = string.Empty;
        TextBoxTOTAL.Text = string.Empty; 
    }
}


how to calculate salary on the basic of leave day | sradha webcreations

how to calculate salary on the basic of leave day

salary calculation on the basic of leave day



EMP NAME
BASIC SALAR
LEAVE DAY
HRA
TOTAL SALARY

save


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;

public partial class leaveday : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void TextBoxLEAVE_TextChanged(object sender, EventArgs e)
    {
        string sName = TextBoxNAME.Text;
        double dbasic = Convert.ToDouble(TextBoxBASIC.Text);
        int iLeave = Convert.ToInt32(TextBoxLEAVE.Text);
        double dHra;
        double dTotal;
        if (iLeave >= 15)
        {
            dHra = 0;
        }
        else
        {
            dHra = 1500;
        }
        TextBoxHRA.Text = Convert.ToString(dHra);
        dTotal = dbasic + dHra;
        TextBoxTOTAL.Text = Convert.ToString(dTotal);
    }
    protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string ConnectionString= ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString;
        string insertsql = "insert into LeaveDay(name,basic,leave,hra,total)values(@name,@basic,@leave,@hra,@total)";
        using (SqlConnection myconnection = new SqlConnection(ConnectionString))
        {
            myconnection.Open();
    SqlCommand mycommand = new SqlCommand(insertsql,myconnection);
           mycommand.Parameters.AddWithValue("@name",TextBoxNAME.Text);
            mycommand.Parameters.AddWithValue("@basic",TextBoxBASIC.Text);
            mycommand.Parameters.AddWithValue("@leave",TextBoxLEAVE.Text);
    mycommand.Parameters.AddWithValue("@hra",TextBoxHRA.Text);
          mycommand.Parameters.AddWithValue("@total",TextBoxTOTAL.Text);

            mycommand.ExecuteNonQuery();
            myconnection.Close();
        }
        TextBoxNAME.Text = string.Empty;
        TextBoxBASIC.Text = string.Empty;
        TextBoxLEAVE.Text = string.Empty;
        TextBoxHRA.Text = string.Empty;
        TextBoxTOTAL.Text = string.Empty;
        }
}



DATE DATA TYPE CALCULATION IN ASP.NET | Sradha webcreations

DATE DATA TYPE CALCULATION IN ASP.NET


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class LIBRARY : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonTOTALDAY_Click(object sender, EventArgs e)
    {
        string sCardNumber;
        string sBookNumber;
        string sStudentName;
       
        string sIssuedDate=TextBoxISSUE.Text;
        DateTime d1=Convert.ToDateTime(sIssuedDate);

        string sReturnDate=TextBoxRETURN.Text;
        DateTime d2=Convert.ToDateTime(sReturnDate);
     
        int iNumberOfDay;

        sCardNumber = TextBoxCARD.Text;
        sBookNumber = TextBoxBOOK.Text;
        sStudentName = TextBoxNAME.Text;
        
       iNumberOfDay = ((TimeSpan)(d2-d1)).Days;
       TextBoxNOOFDAY.Text = Convert.ToString(iNumberOfDay);

    }

    protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string connectionstring= ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
        string insertsql = "insert into library(cardnumber,bookname,name,issueddate,returndate,noofday)values(@cardnumber,@bookname,@name,@issueddate,@returndate,@noofday)";

  using (SqlConnection myconnection = new SqlConnection(connectionstring))
        {
            myconnection.Open();
       SqlCommand mycommand = new SqlCommand(insertsql,myconnection);
           mycommand.Parameters.AddWithValue("@cardnumber",TextBoxCARD.Text);
           mycommand.Parameters.AddWithValue("@bookname",TextBoxBOOK.Text);
            mycommand.Parameters.AddWithValue("@name",TextBoxNAME.Text);
            mycommand.Parameters.AddWithValue("@issueddate",TextBoxISSUE.Text);
            mycommand.Parameters.AddWithValue("@returndate",TextBoxRETURN.Text);
            mycommand.Parameters.AddWithValue("@noofday",TextBoxNOOFDAY.Text);

            mycommand.ExecuteNonQuery();
            myconnection.Close();
             }
        TextBoxCARD.Text = string.Empty;
        TextBoxBOOK.Text = string.Empty;
        TextBoxNAME.Text = string.Empty;
        TextBoxISSUE.Text = string.Empty;
        TextBoxRETURN.Text = string.Empty;
        TextBoxNOOFDAY.Text = string.Empty;
    }
 }Bottom of Form