示例#1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            EmpBusiness ebb  = new EmpBusiness();
            int         l    = ebb.getEmpLeave(Convert.ToInt32(Session["username"]));
            EmpBusiness ebbb = new EmpBusiness();
            Employee    p    = ebbb.getEmpOnId(Convert.ToInt32(Session["username"]));

            TimeSpan ts       = Calendar2.SelectedDate - Calendar1.SelectedDate;
            int      leavLeft = p.Leaves - l - ts.Days;

            if (leavLeft > 0)
            {
                EmpLeave el = new EmpLeave();
                el.EmpId    = Convert.ToInt32(Session["username"]);
                el.FromDate = Calendar1.SelectedDate;
                el.ToDate   = Calendar2.SelectedDate;
                el.Descr    = TextBox1.Text;
                ebb.insertEmpLeave(el);
                string body = "Emp Id with" + el.EmpId + "has applied leave from " + el.FromDate + " to " + el.ToDate + " for the particular reason " + el.Descr;
                Email  s    = new Email();
                s.SendEmail(body);
                Response.Redirect(Request.Url.AbsoluteUri);
            }

            else
            {
                Label1.Visible = true;
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EmpBusiness eb = new EmpBusiness();
            int         s  = Convert.ToInt32(Session["username"]);

            EmpEntity.Employee ew = eb.getEmpOnId(s);
            Label3.Text = ew.Leaves.ToString();
            int leavesTaken = eb.getEmpLeave(s);

            Label4.Text = (ew.Leaves - leavesTaken).ToString();
        }
示例#3
0
        public void setlabels()
        {
            int         ids = Convert.ToInt32(Session["username"]);
            EmpBusiness ebb = new EmpBusiness();
            Employee    eq  = new Employee();

            eq          = ebb.getEmpOnId(ids);
            Label2.Text = eq.EmpId.ToString();
            Label3.Text = eq.FirstName;
            Label4.Text = eq.MiddleName;
            Label5.Text = eq.LastName;
            Label6.Text = eq.Addreee;
            Label7.Text = eq.City;
            Label8.Text = eq.State;
            string[] zip = eq.ZipCode.Split('-');
            Label9.Text = zip[0].ToString() + '-' + zip[1].ToString();
            //Label8.Text =
            Label10.Text = eq.PhoneNumber;
            Label11.Text = eq.EmailId;
            Label12.Text = eq.Department;
            Label14.Text = Convert.ToString(eq.Salary);
            Label15.Text = eq.Leaves.ToString();
            Label16.Text = eq.Position;
            if (eq.Picture != string.Empty)
            {
                Image1.ImageUrl = "images/" + eq.Picture;
            }


            //if (Session["admin"] == "false")
            //{
            //    //   setlabels();
            //    Panel1.Visible = true;
            //    Panel2.Visible = false;
            //}
            //else
            //{
            //    Panel2.Visible = true;
            //    Panel1.Visible = true;
            //}
        }
示例#4
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            int ids = 0;

            ids = Convert.ToInt32(TextBox15.Text);
            EmpBusiness ebb = new EmpBusiness();
            Employee    eq  = new Employee();

            eq = ebb.getEmpOnId(ids);
            if (eq.EmpId != 0)
            {
                TextBox1.Text = eq.FirstName;
                TextBox2.Text = eq.MiddleName;
                TextBox3.Text = eq.LastName;
                TextBox4.Text = eq.Addreee;
                TextBox5.Text = eq.City;
                TextBox6.Text = eq.State;
                string[] zip = eq.ZipCode.Split('-');
                TextBox7.Text  = zip[0].ToString();
                TextBox8.Text  = zip[1].ToString();
                TextBox9.Text  = eq.PhoneNumber;
                TextBox10.Text = eq.EmailId;
                TextBox11.Text = Convert.ToString(eq.Salary);
                TextBox12.Text = eq.Leaves.ToString();
                TextBox14.Text = eq.Position;
                Label1.Text    = eq.Department.ToString();
                DropDownList1.SelectedItem.Text = eq.Department.ToString();
                if (eq.Picture != string.Empty)
                {
                    Image1.ImageUrl = "images/" + eq.Picture;
                }
            }
            else
            {
                Label17.Text    = "Employee Not Found";
                Label17.Visible = true;
            }
        }