Showing posts with label LABOUR OVER DUTY management system in asp.net. Show all posts
Showing posts with label LABOUR OVER DUTY management system in asp.net. Show all posts

Thursday, July 26, 2018

LABOUR OVER DUTY management system in asp.net | sradha webcreations

LABOUR OVER DUTY management system in asp.net



LABOUR OVERDUTY




ENTER LABOUR NAME

ENTER WORKING HOUR

LABOUR CHARGE

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 LABOUR : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
 protected void TextBoxWORKING_TextChanged(object sender, EventArgs e)
    {
        string sName = TextBoxNAME.Text;
        int iWorkingHours = Convert.ToInt32(TextBoxWORKING.Text);
        double dLabourCharge;
        int iExtraHours;

        if (iWorkingHours <= 8)
        {
            dLabourCharge = 250;
        }
        else
        {
            iExtraHours = iWorkingHours - 8;
            dLabourCharge = (iExtraHours * 200)+250;
        }
        TextBoxLABOURCHARGE.Text = Convert.ToString(dLabourCharge);
    }
    protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string connectionstring = ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString;
        string insertsql = "insert into labourcharge(labourName,WorkingHours,LabourCharge)values(@labourName,@WorkingHours,@LabourCharge)";

        using (SqlConnection myconnection = new SqlConnection(connectionstring))
        {
            myconnection.Open();
            SqlCommand mycommand = new SqlCommand(insertsql, myconnection);
  mycommand.Parameters.AddWithValue("@labourname", TextBoxNAME.Text);
mycommand.Parameters.AddWithValue("@workinghours", TextBoxWORKING.Text); mycommand.Parameters.AddWithValue("labourcharge", TextBoxLABOURCHARGE.Text);

            mycommand.ExecuteNonQuery();
            mycommand.Clone();
        }
        TextBoxNAME.Text = string.Empty;
        TextBoxWORKING.Text = string.Empty;
        TextBoxLABOURCHARGE.Text = string.Empty;
      }
}