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;
}
}
#SradhaWebCreations
Contact : +91-9040573923, +91-7008182025
http://sradhawebcreations.com/
http://sradhawebcreations.blogspot.in/
https://facebook.com/sradhawebcreations
Contact : +91-9040573923, +91-7008182025
http://sradhawebcreations.com/
http://sradhawebcreations.blogspot.in/
https://facebook.com/sradhawebcreations