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!";
            }
        }
예제 #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));
        }
예제 #3
0
 public static void InsertStaff(faculty staff)
 {
     using (ASMDataContext context = new ASMDataContext())
     {
         context.faculties.InsertOnSubmit(staff);
         context.SubmitChanges();
     }
 }
예제 #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();
         }
     }
 }
예제 #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();
                }
            }
        }
예제 #6
0
 partial void Deletefaculty(faculty instance);
예제 #7
0
 partial void Updatefaculty(faculty instance);
예제 #8
0
 partial void Insertfaculty(faculty instance);