protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtEmpno.Text == string.Empty)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "m2", "alert('Please enter id to search')", true);
     }
     else
     {
         try
         {
             int    searchid = Convert.ToInt32(txtEmpno.Text);
             Employ employ   = EmployBLL.GetEmployBLL(searchid);
             if (employ != null)
             {
                 txtname.Text  = employ.Name;
                 txtDept.Text  = employ.Department;
                 txtDesig.Text = employ.Designation;
                 txtbasic.Text = employ.Basic.ToString();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "m4", "alert('Employ not available')", true);
             }
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "error1", "alert('" + ex.Message + "')", true);
         }
     }
 }
示例#2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Employ employ = new Employ();

            try
            {
                employ.Empno       = Convert.ToInt32(txtEmpno.Text);
                employ.Name        = txtname.Text;
                employ.Department  = txtDept.Text;
                employ.Designation = txtDesig.Text;
                employ.Basic       = Convert.ToInt32(txtbasic.Text);
                bool status = EmployBLL.AddEmployBLL(employ);
                if (status)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "M1", "alert('Employ Details Added')", true);
                    txtEmpno.Text = "";
                    txtname.Text  = "";
                    txtDept.Text  = "";
                    txtDesig.Text = "";
                    txtbasic.Text = "";
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "M1", "alert('" + ex.Message + "')", true);
            }
        }
示例#3
0
        public ActionResult Edit(Employ employ)
        {
            bool status = EmployBLL.UpdateEmployBLL(employ);

            if (status)
            {
                return(RedirectToAction("Index", "Employ"));
            }
            return(View());
        }
示例#4
0
        public ActionResult Delete(Employ employ)
        {
            int    id     = Convert.ToInt32(employ.Empno);
            string status = EmployBLL.DeleteEmployBLL(id);

            if (status.Equals("Record not Found.."))
            {
                return(RedirectToAction("Index", "Employ"));
            }
            return(View());
        }
示例#5
0
        public frmManageEmployee()
        {
            InitializeComponent();
            // load tat ca cac bien tham so lua chon...
            employBLL = new EmployBLL();
            employSea = new Employees();

            LoadStatus();
            LoadPositionId();
            LoadObject();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         List <Employ> bList = EmployBLL.GetEmploysBLL();
         GridView1.DataSource = bList.ToList();
         GridView1.DataBind();
     }
     catch (Exception ex)
     {
         lblerror.Text = ex.Message;
     }
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtEmpno.Text == string.Empty)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "m2", "alert('Please enter id to Delete')", true);
     }
     else
     {
         try
         {
             int    deleteId = Convert.ToInt32(txtEmpno.Text);
             string status   = EmployBLL.DeleteEmployBLL(deleteId);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "m3", "alert('" + status + "')", true);
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "alert('" + ex.Message + "')", true);
         }
     }
 }
示例#8
0
        //public ActionResult Edit(int id, FormCollection collection)
        //{
        //    try
        //    {
        //        // TODO: Add update logic here

        //        return RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}

        // GET: Employ/Delete/5
        public ActionResult Delete(int id)
        {
            Employ employ = EmployBLL.GetEmployBLL(id);

            return(View(employ));
        }
示例#9
0
        // GET: Employ
        public ActionResult Index()
        {
            List <Employ> eList = EmployBLL.GetEmploysBLL();

            return(View(eList));
        }