protected void btnChange_Click(object sender, EventArgs e)
        {
            int obj = 0;

            int.TryParse(ChangePwdIdHiddenField.Value, out obj);
            // txtNewpwd.Text
            string fname = FacultyDAL.ChangePassword(Session["fcode"].ToString(), txtOldpwd.Text);

            if (fname == null)
            {
                lblMsg.Text = "Sorry! Invalid OldPassword! Try Again.";
            }
            else
            {
                faculty staff = new DataAccess.faculty();
                staff.fcode = Session["fcode"].ToString();
                staff.pwd   = txtNewpwd.Text;


                staff.admno = obj;

                Manager.UpdateLogin(staff);

                lblMsg.Text = "Password Changed Sucessfully!";
            }
        }
Ejemplo n.º 2
0
        protected void Addstaff_Click(object sender, EventArgs e)
        {
            int staffId = 0;

            int.TryParse(StaffIdHiddenField.Value, out staffId);

            DA.faculty staff = new DataAccess.faculty();
            staff.fname   = SFnameBox.Text;
            staff.Surname = SSnameBox.Text;
            staff.dept    = DeptTextBox.Text;
            staff.fcode   = UnameBox.Text;
            staff.pwd     = PwsdTextBox.Text;

            if (staffId > 0)
            {
                staff.admno = staffId;

                DA.Manager.UpdateStaff(staff);
            }
            else
            {
                DA.Manager.InsertStaff(staff);
            }

            //After insert, redirect to update page
            Response.Redirect(String.Format("AddNewStaff.aspx?StaffId={0}", staff.admno));
        }
Ejemplo n.º 3
0
 public static void InsertStaff(faculty staff)
 {
     using (ASMDataContext context = new ASMDataContext())
     {
         context.faculties.InsertOnSubmit(staff);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
 public static void UpdateLogin(faculty obj)
 {
     using (ASMDataContext context = new ASMDataContext())
     {
         var login = context.faculties.SingleOrDefault(x => x.admno == obj.admno);
         if (login != null)
         {
             login.fcode = obj.fcode;
             login.pwd   = obj.pwd;
             context.SubmitChanges();
         }
     }
 }
Ejemplo n.º 5
0
        public static void UpdateStaff(faculty staff)
        {
            using (ASMDataContext context = new ASMDataContext())
            {
                var dbStaff = context.faculties.SingleOrDefault(x => x.fname == staff.fname);
                if (dbStaff != null)
                {
                    dbStaff.fname   = staff.fname;
                    dbStaff.Surname = staff.Surname;
                    dbStaff.dept    = staff.dept;

                    context.SubmitChanges();
                }
            }
        }
Ejemplo n.º 6
0
 partial void Deletefaculty(faculty instance);
Ejemplo n.º 7
0
 partial void Updatefaculty(faculty instance);
Ejemplo n.º 8
0
 partial void Insertfaculty(faculty instance);