コード例 #1
0
        }//insert Student Record

        public static bool updateStudent(EntityStudent estud)
        {
            bool b = false;

            try
            {
                SqlCommand     cmd = createCommand(estud);
                SqlDataAdapter adp = new SqlDataAdapter(cmd);
                DataSet        ds  = new DataSet();
                adp.Fill(ds);
                b = true;
            }
            catch (Exception ex)
            {
                b = false;
            }

            return(b);
        }//Update Student Record
コード例 #2
0
ファイル: LoginController.cs プロジェクト: ZHL929/CKSP
        public IActionResult Forget(string userName, string pwd, string value)
        {
            int i = 0;

            if (value == "1")
            {
                EntityTeacher teacher = SqlSugarHelper.Instance.Queryable <EntityTeacher>().First(it => it.TeacherName == userName);
                teacher.TeacherPassword = pwd;
                var list = SqlSugarHelper.Instance.Updateable(teacher).WhereColumns(it => new { it.TeacherName }).ExecuteCommand();
                if (list > 0)
                {
                    i += 1;
                }
            }
            if (value == "2")
            {
                EntityStudent student = SqlSugarHelper.Instance.Queryable <EntityStudent>().First(it => it.StudentName == userName);
                student.StudentPassword = pwd;
                var list = SqlSugarHelper.Instance.Updateable(student).WhereColumns(it => new { it.StudentName }).ExecuteCommand();
                if (list > 0)
                {
                    i += 1;
                }
            }
            if (value == "3")
            {
                EntityAdmin admin = SqlSugarHelper.Instance.Queryable <EntityAdmin>().First(it => it.AdminName == userName);
                admin.AdminPassword = pwd;
                var list = SqlSugarHelper.Instance.Updateable(admin).WhereColumns(it => new { it.AdminName }).ExecuteCommand();
                if (list > 0)
                {
                    i += 1;
                }
            }
            if (i != 0)
            {
                return(Ok(new { Message = "密码重置成功", Code = 1 }));
            }
            else
            {
                return(Ok(new { Message = "密码重置失败", Code = 0 }));
            }
        }
コード例 #3
0
 public static bool LLStudentLogIn(EntityStudent student)
 {
     foreach (EntityStudent item in DALStudent.StudentList())
     {
         if (item.StudentUserName == student.StudentUserName && item.Password == student.Password)
         {
             student.StudentId       = item.StudentId;
             student.StudentName     = item.StudentName;
             student.StudentLastName = item.StudentLastName;
             student.StudentUserName = item.StudentUserName;
             student.Password        = item.Password;
             student.Repassword      = item.Repassword;
             student.StudentGender   = item.StudentGender;
             student.StudentDebt     = item.StudentDebt;
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
        private static SqlCommand createCommand(EntityStudent estud)
        {
            SqlCommand cmd = new SqlCommand("SPDDLDMLStudent", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@task", estud.Task);
            cmd.Parameters.AddWithValue("@name", estud.Name);
            cmd.Parameters.AddWithValue("@address", estud.Address);
            cmd.Parameters.AddWithValue("@age", estud.Age);
            cmd.Parameters.AddWithValue("@DOB", estud.DOB1);
            cmd.Parameters.AddWithValue("@contactnum", estud.Contactnumb);
            cmd.Parameters.AddWithValue("@id", estud.Id);
            cmd.Parameters.AddWithValue("@EmailId", estud.Emailid);
            cmd.Parameters.AddWithValue("@gender", estud.Gender);
            //cmd.Parameters.AddWithValue("@PageSize", estud.pagesize);
            //cmd.Parameters.AddWithValue("@PageIndex", estud.PageIndex);
            //cmd.Parameters.AddWithValue("@task", estud.Task);
            //cmd.Parameters.AddWithValue("@task", estud.Task);
            return(cmd);
        } //Creating command to pass the value and interact with SQL
コード例 #5
0
        private void BtnStudentAdd_Click(object sender, EventArgs e)
        {
            // Textbox'lardan gelen veriler kontrol ediliyor boş veri varsa uyarı mesajı bırakıyoruz çünkü veritabanında boş verilerin bulunmasını istemiyoruz
            // EntityStudent üzerinde oluşturduğumuz nesnemize gerekli atamaları yaptıktan sonra
            // Nesnelerimizin kontrolünü yapmak üzere Mantıksal Katmana verilerimizi gönderiyoruz.
            if (TxtStudentName.Text != "" && TxtStudentLastName.Text != "" && TxtStudentPassword1.Text != "" &&
                TxtStudentPassword2.Text != "" && TxtStudentUserName.Text != "" && CmbStudentGender.Text != "" && TxtStudentDebt.Text != "")
            {
                EntityStudent ent = new EntityStudent();
                ent.StudentName     = TxtStudentName.Text;
                ent.StudentLastName = TxtStudentLastName.Text;
                ent.Password        = TxtStudentPassword1.Text;
                ent.Repassword      = TxtStudentPassword2.Text;
                ent.StudentUserName = TxtStudentUserName.Text;
                ent.StudentGender   = CmbStudentGender.Text;
                ent.StudentDebt     = int.Parse(TxtStudentDebt.Text);
                LogicPersonal.LLStudentSave(ent);
                MessageBox.Show("Öğrenci Başarılı Bir Şekilde Kaydedildi");
                TxtStudentId.Text        = "";
                TxtStudentName.Text      = "";
                TxtStudentLastName.Text  = "";
                TxtStudentPassword1.Text = "";
                TxtStudentPassword2.Text = "";
                TxtStudentUserName.Text  = "";
                CmbStudentGender.Text    = "";
                TxtStudentDebt.Text      = "";
                // Data Gride verileri getirmek için EntityStudent class'ından StudentList adında generic bir liste oluşturuyoruz ve Mantıksal Katman(Logic Layer)
                // üzerinden LLStudentList methodu Veri Erişim Katmanına Erişerek (DAL) gerekli SQL sorgusu ile öğrenciler hakkında tüm bilgiler getirilir.
                List <EntityStudent> StudentList = LogicStudent.LLStudentList();
                // DataSource veri kaynağı olarak bir Generic List almaktadır

                dataGridView1.DataSource = StudentList;
                dataGridView1.Columns["Password"].Visible   = false;
                dataGridView1.Columns["Repassword"].Visible = false;
            }
            else
            {
                MessageBox.Show("Alanları Boş Bırakmayınız");
            }
        }
コード例 #6
0
 private void BtnStudentDelete_Click(object sender, EventArgs e)
 {
     // Sadece ID kontrol etmemiz yeterli VeriTabanından Kayıtlar Nesneyi eşsiz yapan bir özelliği üzerinden silinirler
     // ID her öğrencinin benzersiz sahip olduğu bir özelliktir
     if (TxtStudentId.Text != "")
     {
         EntityStudent ent = new EntityStudent();
         ent.StudentId = int.Parse(TxtStudentId.Text);
         LogicPersonal.LLStudentDelete(ent.StudentId);
         MessageBox.Show("Güncelleme Başarılı Bir Şekilde Silindi");
         TxtStudentName.Text      = "";
         TxtStudentLastName.Text  = "";
         TxtStudentPassword1.Text = "";
         TxtStudentPassword2.Text = "";
         TxtStudentUserName.Text  = "";
         CmbStudentGender.Text    = "";
         TxtStudentDebt.Text      = "";
     }
     else
     {
         MessageBox.Show("Id ALanını Boş Bırakmayınız");
     }
 }
コード例 #7
0
        private void StudentSignIn_Click(object sender, EventArgs e)
        {
            EntityStudent ent = new EntityStudent();

            ent.StudentUserName = TxtStudentUserName.Text;
            ent.StudentName     = TxtStudentName.Text;
            ent.StudentLastName = TxtStudentLastName.Text;
            ent.Password        = TxtStudentPassword1.Text;
            ent.Repassword      = TxtStudentPassword2.Text;
            if (ent.Password == ent.Repassword)
            {
                LogicStudent.LLStudentSignIn(ent);
                MessageBox.Show("Başarılı Bir Şekilde Kayıt Oldunuz Giriş Yapabilirsiniz");
                TxtStudentUserName.Text  = "";
                TxtStudentName.Text      = "";
                TxtStudentLastName.Text  = "";
                TxtStudentPassword1.Text = "";
                TxtStudentPassword2.Text = "";
            }
            else
            {
                MessageBox.Show("Şifreleriniz Uyuşmuyor Lütfen Kontrol Ediniz");
            }
        }
コード例 #8
0
        }//get all rec() call

        public static DataSet getSingeStudentData(EntityStudent estud)
        {
            DataSet dsget = DALStudent.getSingeStudentData(estud);

            return(dsget);
        } //fetch record according to id call
コード例 #9
0
        }//delete() call

        public static DataSet getStudentData(EntityStudent estud)
        {
            DataSet dsget = DALStudent.getStudentData(estud);

            return(dsget);
        }//get all rec() call
コード例 #10
0
        }//update() call

        public static bool deleteStudent(EntityStudent estud)
        {
            bool b = DALStudent.deleteStudent(estud);

            return(b);
        }//delete() call
コード例 #11
0
        }//insertion() call

        public static bool updateStudent(EntityStudent estud)
        {
            bool b = DALStudent.updateStudent(estud);

            return(b);
        }//update() call
コード例 #12
0
        public static bool insertStudent(EntityStudent estud)
        {
            bool b = DALStudent.insertStudent(estud);

            return(b);
        }//insertion() call
コード例 #13
0
        }//assigning values to Control

        private void insertStudent()
        {
            try
            {
                if (!string.IsNullOrEmpty(txtName.Text) && !string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtcntnum.Text) && !string.IsNullOrEmpty(txtAge.Text) && !string.IsNullOrEmpty(txtaddress.Text))
                {
                    EntityStudent es = new EntityStudent();

                    es.Name        = txtName.Text;
                    es.Address     = txtaddress.Text;
                    es.Age         = Convert.ToInt16(txtAge.Text);
                    es.DOB1        = DateTime.Parse(clddate.Text);
                    es.Emailid     = txtEmail.Text;
                    es.Contactnumb = Convert.ToDouble(txtcntnum.Text);
                    if (rdMale.Checked == true)
                    {
                        es.Gender = false;
                    }
                    else
                    {
                        es.Gender = true;
                    }
                    if (btnsave.Text.Equals("Save"))
                    {
                        es.Task = 1;
                        bool b = BLLStudent.insertStudent(es);
                        clearControls();
                        if (b == true)
                        {
                            Response.Redirect("StudentView.aspx?stud={0}");
                            clearControls();
                        }
                        else
                        {
                            btnclose.Visible = true;
                            ltrlerror.Text   = "Error while insertion";
                        }
                    }
                    if (btnsave.Text.Equals("Update"))
                    {
                        es.Task = 2;
                        es.Id   = int.Parse(ViewState["Id"].ToString());
                        bool b = BLLStudent.updateStudent(es);
                        if (b == true)
                        {
                            Response.Redirect("StudentView.aspx?stud1={1}");
                            clearControls();
                        }
                        else
                        {
                            btnclose.Visible = true;
                            ltrlerror.Text   = "Error while Updation";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ltrlerror.Text   = "Error";
                btnclose.Visible = true;
            }
        }//insertion and updation
コード例 #14
0
 public StudentBookUI(EntityStudent student)
 {
     InitializeComponent();
     this.student = student;
 }