Beispiel #1
0
        protected void gvDepartment_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int rowIndex = Convert.ToInt32(e.CommandArgument);

                GridViewRow row = gvDepartment.Rows[rowIndex];

                int    Id   = Convert.ToInt32((row.FindControl("lblId") as Label).Text);
                string name = (row.FindControl("lblName") as Label).Text;

                DepartmentBS        departmentBS = new DepartmentBS();
                ClsDepartmentResult result       = departmentBS.ProcessRemove(new DepartmentBO()
                {
                    Id   = Id,
                    Name = name
                });

                if (result.Success)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Deparment Name: " + name + "');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true);
                }
            }
        }
Beispiel #2
0
 public DepartmentDal()
 {
     studentEntities = new DataAccessLayour.StudentEntities();
     result          = new ClsDepartmentResult()
     {
         Success = true
     };
 }
Beispiel #3
0
 public void CreateDepartment()
 {
     var                 Name         = "Physics";
     DepartmentBS        departmentBS = new DepartmentBS();
     ClsDepartmentResult result       = departmentBS.ProcessSave(new DepartmentBO()
     {
         Name = Name
     });
 }
Beispiel #4
0
        public void DeleteDepartment()
        {
            int    Id   = 1;
            string name = "Physics";

            DepartmentBS        departmentBS = new DepartmentBS();
            ClsDepartmentResult result       = departmentBS.ProcessRemove(new DepartmentBO()
            {
                Id   = Id,
                Name = name
            });
        }
Beispiel #5
0
        protected void btn_Click(object sender, EventArgs e)
        {
            var                 Name         = txtDepartment.Text;
            DepartmentBS        departmentBS = new DepartmentBS();
            ClsDepartmentResult result       = departmentBS.ProcessSave(new DepartmentBO()
            {
                Name = Name
            });

            if (result.Success)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Inserted');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true);
            }
        }