예제 #1
0
 protected void gridPayslips_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int    payslipid = Convert.ToInt32(gridPayslips.Rows[e.RowIndex].Cells[0].Text);
         string sqlstr    = "delete from payslips where payslipid=" + payslipid;
         BusinessAccessLayer.NonQuery(sqlstr);
         Show();
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }
예제 #2
0
 protected void gridMessages_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int    messageid = Convert.ToInt32(gridMessages.Rows[e.RowIndex].Cells[0].Text);
         string sqlstr    = "update messages set active=0 where messageid=" + messageid;
         BusinessAccessLayer.NonQuery(sqlstr);
         Show();
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }
 protected void lnkYes_Click(object sender, EventArgs e)
 {
     try
     {
         int    employeeid = Convert.ToInt32(Session["deletingemployeeid"]);
         string sqlstr     = "delete from employees where employeeid=" + employeeid;
         BusinessAccessLayer.NonQuery(sqlstr);
         Session["deletingemployeeid"] = null;
         Response.Redirect("employees.aspx", false);
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string date, messagefrom, messageto, message;
         int    employeeid;
         date        = DateTime.Now.ToString();
         messagefrom = Convert.ToString(Session["currentemployeename"]);
         messageto   = "Manager";
         message     = txtMessage.Text;
         employeeid  = Convert.ToInt32(Session["currentemployeeid"]);
         string sqlstr = "insert into messages values('" + date + "','" + messagefrom + "','" + messageto + "','" + message + "'," + employeeid + ",1)";
         BusinessAccessLayer.NonQuery(sqlstr);
         Response.Redirect("employeemessageoutbox.aspx", false);
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string name, phone, email, designation, level, username, password;
         name        = txtName.Text;
         phone       = txtPhone.Text;
         email       = txtEmail.Text;
         designation = txtDesignation.Text;
         level       = dropLevel.SelectedItem.Text;
         username    = txtUsername.Text;
         password    = txtPassword.Text;
         string sqlstr = "insert into employees values('" + name + "','" + phone + "','" + email + "','" + designation + "','" + level + "','" + username + "','" + password + "')";
         BusinessAccessLayer.NonQuery(sqlstr);
         Response.Redirect("employees.aspx", false);
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }
예제 #6
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (Page.IsValid)
         {
             int      employeeid, month, year, noofleaves;
             string   monthname;
             DateTime generatedon;
             decimal  basicsalary, salaryperday, deductionperleaves, netsalary;
             employeeid         = Convert.ToInt32(Session["currentpayslipemployeeid"]);
             month              = dropMonth.SelectedIndex + 1;
             monthname          = dropMonth.SelectedItem.Text;
             year               = Convert.ToInt32(dropYear.SelectedItem.Text);
             generatedon        = DateTime.Now;
             basicsalary        = Convert.ToDecimal(lblBasicSalary.Text);
             noofleaves         = Convert.ToInt32(txtNoOfLeaves.Text);
             salaryperday       = Convert.ToDecimal(lblSalaryPerDay.Text);
             deductionperleaves = Convert.ToDecimal(lblDeductionForLeaves.Text);
             netsalary          = Convert.ToDecimal(lblNetSalary.Text);
             DataTable dt = BusinessAccessLayer.Query("select * from payslips where employeeid=" + employeeid + " and month=" + month + " and year=" + year);
             string    sqlstr;
             if (dt.Rows.Count == 0)
             {
                 sqlstr = "insert into payslips values(" + employeeid + "," + month + ",'" + monthname + "'," + year + ",'" + generatedon.ToString("yyyy-MM-ddTHH:mm:ss.fff") + "'," + basicsalary + "," + noofleaves + "," + salaryperday + "," + deductionperleaves + "," + netsalary + ")";
             }
             else
             {
                 sqlstr = "update payslips set generatedon='" + generatedon.ToString() + "',basicsalary=" + basicsalary + ",noofleaves=" + noofleaves + ",salaryperday=" + salaryperday + ",deductionforleaves=" + deductionperleaves + ",netsalary=" + netsalary + " where employeeid=" + employeeid + " and month=" + month + " and year=" + year;
             }
             BusinessAccessLayer.NonQuery(sqlstr);
             Response.Redirect("payslips.aspx");
         }
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string date, messagefrom, messageto, message;
         int    employeeid;
         date        = DateTime.Now.ToString();
         messagefrom = from;
         messageto   = dropTo.SelectedItem.Text;
         message     = txtMessage.Text;
         DataTable dt = BusinessAccessLayer.Query("select employeeid from employees where name='" + messageto + "'");
         if (dt.Rows.Count > 0)
         {
             employeeid = Convert.ToInt32(dt.Rows[0]["employeeid"]);
             string sqlstr = "insert into messages values('" + date + "','" + messagefrom + "','" + messageto + "','" + message + "'," + employeeid + ",1)";
             BusinessAccessLayer.NonQuery(sqlstr);
         }
         Response.Redirect("managermessageoutbox.aspx", false);
     }
     catch (Exception ex)
     {
         lblError.Text = "Error: " + ex.Message;
     }
 }