private bool SaveBasicDetails(tbl_Std_Admission_Details basicdetails)
        {
            bool result = false;

            using (OnlineStudentAdmissionEntities1 _entity = new OnlineStudentAdmissionEntities1())
            {
                int       userid = Convert.ToInt32(Session["ID"].ToString());
                UserLogIn _user  = _entity.UserLogIn.Where(x => x.Id == userid).Select(x => x).FirstOrDefault();
                basicdetails.Username = _user.Username;
                basicdetails.Password = _user.Password;
                if (Session["Admission_id"] == null)
                {
                    _entity.tbl_Std_Admission_Details.Add(basicdetails);
                    _entity.SaveChanges();
                    result = true;
                    tbl_Std_Admission_Details _student = _entity.tbl_Std_Admission_Details.Where(x => x.CreatedBy == userid).Select(x => x).FirstOrDefault();
                    _student.Admission_Id   = basicdetails.Admission_Id;
                    Session["Admission_Id"] = _student.Admission_Id;
                }
                else
                {
                    tbl_Std_Admission_Details _student = _entity.tbl_Std_Admission_Details.Where(x => x.CreatedBy == userid).Select(x => x).FirstOrDefault();
                    _student.Name     = basicdetails.Name;
                    _student.Mobile   = basicdetails.Mobile;
                    _student.Gender   = basicdetails.Gender;
                    _student.Category = basicdetails.Category;
                    _entity.SaveChanges();
                    result = true;
                }
            }
            return(result);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (OnlineStudentAdmissionEntities1 _entity = new OnlineStudentAdmissionEntities1())
            {
                if (Session["ID"] != null)
                {
                    int userid = Convert.ToInt32(Session["ID"]);
                    tbl_Std_Admission_Details _student = _entity.tbl_Std_Admission_Details.Where(x => x.CreatedBy == userid).Select(x => x).FirstOrDefault();
                    if (_student != null)
                    {
                        if (_student.Admission_Id != null)
                        {
                            {
                                Session["Admission_id"]    = _student.Admission_Id;
                                lblApplicantName.Text      = _student.Name;
                                lblAppplicationStatus.Text = _student.Application_Status ? "Submitted" : "Pending";
                                lblVerification.Text       = _student.Verification_Status ? "Verified" : "Pending";
                                lblAdmission_Id.Text       = _student.Admission_Id;

                                if (_student.Application_Status == true)
                                {
                                    Session["Application_Status"] = "Submitted";
                                }
                                else
                                {
                                    Session["Application_Status"] = "Pending";
                                }
                            }
                        }
                    }
                }
            }
        }
 protected void btnBasic_Click(object sender, EventArgs e)
 {
     try
     {
         using (OnlineStudentAdmissionEntities1 _entity = new OnlineStudentAdmissionEntities1())
         {
             tbl_Std_Admission_Details basicdetails = new tbl_Std_Admission_Details();
             basicdetails.Name        = txtApplicantName.Text.Trim();
             basicdetails.Mobile      = Convert.ToInt32(txtMobile.Text);
             basicdetails.Email       = txtEmail.Text.Trim();
             basicdetails.Gender      = rdGender.SelectedValue;
             basicdetails.Category    = ddlCategory.SelectedValue;
             basicdetails.CreatedBy   = Convert.ToInt32(Session["ID"]);
             basicdetails.CreatedDate = DateTime.Now;
             bool result;
             result = SaveBasicDetails(basicdetails); // calling SaveStudentDetails method to save the record in table.Here passing a basic details object as parameter
             if (result == true)
             {
                 Response.Redirect("Dashboard.aspx");
             }
             else
             {
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow     row         = gdDetails.Rows[e.RowIndex];
            string          Id          = Convert.ToString(gdDetails.DataKeys[e.RowIndex].Values[0]);
            string          name        = (row.FindControl("txtName") as TextBox).Text;
            DateTime        dt          = Convert.ToDateTime((row.FindControl("txtDateofbirth") as TextBox).Text);
            int             mobile      = Convert.ToInt32((row.FindControl("txtMobile") as TextBox).Text);
            string          email       = (row.FindControl("txtEmail") as TextBox).Text;
            RadioButtonList gender      = (row.FindControl("rdGender") as RadioButtonList);
            DropDownList    ddlCategory = (row.FindControl("ddlCategory") as DropDownList);

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                try
                {
                    tbl_Std_Admission_Details user = (from c in entities.tbl_Std_Admission_Details
                                                      where c.Admission_Id == Id
                                                      select c).FirstOrDefault();
                    user.Name        = name;
                    user.Dateofbirth = dt;
                    user.Mobile      = mobile;
                    user.Email       = email;
                    user.Gender      = gender.SelectedValue;
                    user.Category    = ddlCategory.SelectedValue;
                    entities.SaveChanges();
                }
                catch (Exception ex) { }
            }
            gdDetails.EditIndex = -1;
            this.BindGrid();
        }
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow  row             = gdStatus.Rows[e.RowIndex];
            string       Id              = Convert.ToString(gdStatus.DataKeys[e.RowIndex].Values[0]);
            string       name            = (row.FindControl("txtName") as TextBox).Text;
            DropDownList ddlApplicantion = (row.FindControl("ddlApplicantion") as DropDownList);
            DropDownList ddlVerification = (row.FindControl("ddlVerification") as DropDownList);

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                try
                {
                    tbl_Std_Admission_Details user = (from c in entities.tbl_Std_Admission_Details
                                                      where c.Admission_Id == Id
                                                      select c).FirstOrDefault();
                    user.Name = name;
                    user.Application_Status  = Convert.ToBoolean(ddlApplicantion.SelectedValue);
                    user.Verification_Status = Convert.ToBoolean(ddlVerification.SelectedValue);
                    entities.SaveChanges();
                }
                catch (Exception ex) { }
            }
            gdStatus.EditIndex = -1;
            this.BindGrid();
        }
Example #6
0
        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            OnlineStudentAdmissionEntities1 stdAdm = new OnlineStudentAdmissionEntities1();
            var    result = stdAdm.GetLoginInfo(txtUsername.Text.Trim(), txtPassword.Text.Trim());
            string str    = result.FirstOrDefault();

            if (str != "User Does not Exists")
            {
                string userid  = str.Split(',')[0];
                string IsAdmin = str.Split(',')[1];
                Session["ID"] = userid;
                //Session["IsAdmin"] = IsAdmin;
                Session["username"] = txtUsername.Text.Trim();
                if (IsAdmin == "1")
                {
                    Response.Redirect("AdminDashboard.aspx");
                }
                else
                {
                    Response.Redirect("Dashboard.aspx");
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + str + "');", true);
            }
        }
 private void BindGrid()
 {
     using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
     {
         gdDetails.DataSource =
             (from adm in entities.tbl_Std_Admission_Details
              select new { adm.Admission_Id, adm.Name, adm.Dateofbirth, adm.Mobile, adm.Email, adm.Gender, adm.Category }).ToList();
         gdDetails.DataBind();
     }
 }
 private void BindGrid()
 {
     using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
     {
         gdStatus.DataSource =
             (from adm in entities.tbl_Std_Admission_Details
              select new { adm.Admission_Id, adm.Name, adm.Application_Status, adm.Verification_Status, adm.Username }).ToList();
         gdStatus.DataBind();
     }
 }
Example #9
0
        private void BindGrid()
        {
            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                gdUserInfo.DataSource =
                    (from user in entities.UserLogIn
                     select new { user.Id, user.Username, user.Password }).ToList();

                gdUserInfo.DataBind();
            }
        }
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string Id = Convert.ToString(gdDetails.DataKeys[e.RowIndex].Values[0]);

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                tbl_Std_Admission_Details user = (from c in entities.tbl_Std_Admission_Details
                                                  where c.Admission_Id == Id
                                                  select c).FirstOrDefault();
                entities.tbl_Std_Admission_Details.Remove(user);
                entities.SaveChanges();
            }
            this.BindGrid();
        }
Example #11
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int Id = Convert.ToInt32(gdUserInfo.DataKeys[e.RowIndex].Values[0]);

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                UserLogIn user = (from c in entities.UserLogIn
                                  where c.Id == Id
                                  select c).FirstOrDefault();
                entities.UserLogIn.Remove(user);
                entities.SaveChanges();
            }
            this.BindGrid();
        }
Example #12
0
        protected void Insert(object sender, EventArgs e)
        {
            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                UserLogIn user = new UserLogIn
                {
                    Username  = txtUserName.Text,
                    Password  = txtPassword.Text,
                    IsAdmin   = false,
                    LoginDate = System.DateTime.Now
                };
                entities.UserLogIn.Add(user);
                entities.SaveChanges();
                txtPassword.Text = "";
                txtUserName.Text = "";
            }

            this.BindGrid();
        }
Example #13
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row      = gdUserInfo.Rows[e.RowIndex];
            int         Id       = Convert.ToInt32(gdUserInfo.DataKeys[e.RowIndex].Values[0]);
            string      name     = (row.FindControl("txtName") as TextBox).Text;
            string      password = (row.FindControl("txtPassword") as TextBox).Text;

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                UserLogIn user = (from c in entities.UserLogIn
                                  where c.Id == Id
                                  select c).FirstOrDefault();
                user.Username = name;
                user.Password = password;
                entities.SaveChanges();
            }
            gdUserInfo.EditIndex = -1;
            this.BindGrid();
        }
        protected void OnRowEditing(object sender, GridViewEditEventArgs e)
        {
            gdDetails.EditIndex = e.NewEditIndex;
            this.BindGrid();
            GridViewRow     row            = gdDetails.Rows[e.NewEditIndex];
            string          Id             = Convert.ToString(gdDetails.DataKeys[e.NewEditIndex].Values[0]);
            TextBox         txtDateofbirth = (row.FindControl("txtDateofbirth") as TextBox);
            RadioButtonList rdGender       = (row.FindControl("rdGender") as RadioButtonList);

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                try
                {
                    tbl_Std_Admission_Details user = (from c in entities.tbl_Std_Admission_Details
                                                      where c.Admission_Id == Id
                                                      select c).FirstOrDefault();
                    txtDateofbirth.Text    = user.Dateofbirth.ToString("yyyy-MM-dd");
                    rdGender.SelectedValue = user.Gender;
                }
                catch (Exception ex) { }
            }
        }
        protected void OnRowEditing(object sender, GridViewEditEventArgs e)
        {
            gdStatus.EditIndex = e.NewEditIndex;
            this.BindGrid();
            GridViewRow  row             = gdStatus.Rows[e.NewEditIndex];
            string       Id              = Convert.ToString(gdStatus.DataKeys[e.NewEditIndex].Values[0]);
            DropDownList ddlApplicantion = (row.FindControl("ddlApplicantion") as DropDownList);
            DropDownList ddlVerification = (row.FindControl("ddlVerification") as DropDownList);

            using (OnlineStudentAdmissionEntities1 entities = new OnlineStudentAdmissionEntities1())
            {
                try
                {
                    tbl_Std_Admission_Details user = (from c in entities.tbl_Std_Admission_Details
                                                      where c.Admission_Id == Id
                                                      select c).FirstOrDefault();
                    ddlApplicantion.SelectedValue = Boolean.Parse((user.Application_Status).ToString())?"true":"false";
                    ddlVerification.SelectedValue = Boolean.Parse((user.Verification_Status).ToString()) ? "true" : "false";
                }
                catch (Exception ex) { }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Session["Admission_id"] != null)
         {
             using (OnlineStudentAdmissionEntities1 _entity = new OnlineStudentAdmissionEntities1())
             {
                 string Admission_id = Convert.ToString(Session["Admission_id"]);
                 tbl_Std_Admission_Details _student = _entity.tbl_Std_Admission_Details.Where(x => x.Admission_Id == Admission_id).Select(x => x).FirstOrDefault();
                 txtApplicantName.Text     = _student.Name;
                 txtMobile.Text            = Convert.ToString(_student.Mobile);
                 txtEmail.Text             = _student.Email;
                 rdGender.SelectedValue    = _student.Gender;
                 ddlCategory.SelectedValue = _student.Category;
                 if (((string)Session["Application_Status"]) == "Submitted")
                 {
                     btnBasic.Enabled = false;
                 }
             }
         }
     }
 }