Ejemplo n.º 1
0
        protected void Button_Click_Student_Register(object sender, EventArgs e)
        {
            try
            {
                IFormatProvider ff = new CultureInfo("fr-FR", true);


                tblStudent item = new tblStudent();


                item.stdName    = txtStudentName.Text.Trim();
                item.stdAddress = txtAddress.Text.Trim();
                item.ClassId    = int.Parse(drpStdClass.SelectedValue);

                item.stdEmail      = txtStudentEmail.Text.Trim();
                item.stdFatherName = txtFatherName.Text.Trim();
                item.stdMotherName = txtMotherName.Text.Trim();

                item.stdId        = txtStudentId.Text.ToString();
                item.stdBirthDate = DateTime.ParseExact(DateTextbox.Text, "dd.MM.yyyy", ff);

                dbcontext.tblStudents.AddObject(item);
                dbcontext.SaveChanges();


                tblUserLoginInfo item1 = new tblUserLoginInfo();

                item1.userName     = txtUserNameStudent.Text.Trim();
                item1.userPassword = txtPasswordStudent.Text.Trim();
                //item1.userRole = drpType.Text.Trim();
                item1.userRole  = "Student";
                item1.StudentId = item.StudentId;


                dbcontext.tblUserLoginInfoes.AddObject(item1);
                dbcontext.SaveChanges();

                string script = "alert('User Saved');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
            catch
            {
                string script = "alert('Duplicate items are Not Allowed');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
        }
        protected void Button_Click_Guardian_Register(object sender, EventArgs e)
        {
            try
            {
                tblGuardian item = new tblGuardian();

                item.StudentId = int.Parse(drpStudentId.SelectedValue);

                item.StudentId2 = int.Parse(drpStudentId2.SelectedValue);
                item.StudentId3 = int.Parse(drpStudentId3.SelectedValue);
                item.StudentId4 = int.Parse(drpStudentId4.SelectedValue);
                item.StudentId5 = int.Parse(drpStudentId5.SelectedValue);

                item.guardName = txtGuardianName.Text.ToString();
                //  item.guardAddress = txtGuardianAddress.Text.ToString();
                item.guardPhone = txtGuardianContactNo.Text.Trim();
                item.guardEmail = txtGuardianEmail.Text.ToString();
                dbcontext.tblGuardians.AddObject(item);

                tblUserLoginInfo item1 = new tblUserLoginInfo();

                item1.userName     = txtUserNameStudent.Text.Trim();
                item1.userPassword = txtPasswordStudent.Text.Trim();
                item1.userRole     = "Guardian";
                item1.GuardianId   = (int)item.GuardianId;

                dbcontext.tblUserLoginInfoes.AddObject(item1);

                dbcontext.SaveChanges();

                for (int i = 2; i <= 5; i++)
                {
                    var          container = Master.FindControl("ContentPlaceHolder1");
                    string       rayhan    = "drpStudentId" + i;
                    DropDownList lbl       = (DropDownList)container.FindControl(rayhan);
                }
                string script = "alert('User Saved');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
            catch
            {
                string script = "alert('Duplicate items are Not Allowed');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
        }
Ejemplo n.º 3
0
        protected void Button_Click_Teacher_Register(object sender, EventArgs e)
        {
            try
            {
                tblTeacher item = new tblTeacher();

                item.ClassTeacherId = int.Parse(drpClassTeacher.SelectedValue);
                item.tchName        = txtTeacherName.Text.ToString();
                item.tchProfileId   = txtTeacherId.Text.ToString();
                item.tchDesignation = txtTeacherDesignation.Text.ToString();
                item.tchPhone       = txtTeacherContactNo.Text.ToString();
                item.tchEmail       = txtTeacherEmail.Text.ToString();
                item.SSC            = Convert.ToDecimal(txtSSC.Text.Trim());
                item.HSC            = Convert.ToDecimal(txtHSC.Text.Trim());
                item.Honors         = Convert.ToDecimal(txtHonors.Text.Trim());
                item.Masters        = Convert.ToDecimal(txtMasters.Text.Trim());
                item.Others         = txtOtherDegree.Text.Trim();

                dbcontext.tblTeachers.AddObject(item);
                dbcontext.SaveChanges();

                tblUserLoginInfo item1 = new tblUserLoginInfo();

                item1.userName     = txtUserNameStudent.Text.Trim();
                item1.userPassword = txtPasswordStudent.Text.Trim();
                item1.userRole     = "Teacher";
                item1.TeacherId    = (int)item.TeacherId;


                dbcontext.tblUserLoginInfoes.AddObject(item1);
                dbcontext.SaveChanges();

                clear();
                string script = "alert('User Saved');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
            catch
            {
                string script = "alert('Duplicate items are Not Allowed');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
        }
Ejemplo n.º 4
0
        public static void SetUserLoginInfo(SiteUser siteUser, dbTIREntities db)
        {
            var userLoggedInInfo = db.tblUserLoginInfoes.Where(l => l.UserId == siteUser.EdsUserId).FirstOrDefault();

            if (userLoggedInInfo != null)
            {
                userLoggedInInfo.LoginDate       = DateTime.Now.ToUniversalTime();
                db.Entry(userLoggedInInfo).State = EntityState.Modified;
            }
            else
            {
                tblUserLoginInfo userLoginInfo = new tblUserLoginInfo()
                {
                    UserId    = siteUser.EdsUserId,
                    LoginDate = DateTime.Now.ToUniversalTime()
                };
                db.tblUserLoginInfoes.Add(userLoginInfo);
            }
            db.SaveChanges();
        }
Ejemplo n.º 5
0
 public static void SetUserLoginInfo(SiteUser siteUser, dbTIREntities db)
 {
     var userLoggedInInfo = db.tblUserLoginInfoes.Where(l => l.UserId == siteUser.EdsUserId).FirstOrDefault();
     if (userLoggedInInfo != null)
     {
         userLoggedInInfo.LoginDate = DateTime.Now.ToUniversalTime();
         db.Entry(userLoggedInInfo).State = EntityState.Modified;
     }
     else
     {
         tblUserLoginInfo userLoginInfo = new tblUserLoginInfo()
                                          {
                                              UserId = siteUser.EdsUserId,
                                              LoginDate = DateTime.Now.ToUniversalTime()
                                          };
         db.tblUserLoginInfoes.Add(userLoginInfo);
     }
     db.SaveChanges();
 }