コード例 #1
0
ファイル: DALSecUser.cs プロジェクト: Hadisaeed/FYP
        public DataTable SecUser(BALSecUser objBALSecUser)
        {
            DataTable dt = new DataTable();
            //TYPE YOUR STORE PROCEDURE NAME HERE
            string spName = "spro_SecUser";
            SqlParameter[] objSqlParameter = new SqlParameter[5];
            string where = "";
            try
            {
                #region Search

                if (objBALSecUser.WHERE != "")
                {
                    where += where == "" ? " WHERE " : " AND ";
                    where += objBALSecUser.WHERE;
                }
                if (objBALSecUser.UserKey != 0)
                {
                    where += where == "" ? " WHERE " : " AND ";
                    where += "UserKey=" + objBALSecUser.UserKey;
                }
                if (objBALSecUser.UserID != "")
                {
                    where += where == "" ? " WHERE " : " AND ";
                    where += "UserID='" + objBALSecUser.UserID + "'";
                }
                if (objBALSecUser.Password != "")
                {
                    where += where == "" ? " WHERE " : " AND ";
                    where += "Password='******'";
                }
                objBALSecUser.WHERE = where;
                #endregion

                #region Add

                objSqlParameter[0] = new SqlParameter("@CRUD", objBALSecUser.CRUD);
                objSqlParameter[1] = new SqlParameter("@WHERE", objBALSecUser.WHERE);

                objSqlParameter[2] = new SqlParameter("@UserKey", objBALSecUser.UserKey);

                objSqlParameter[3] = new SqlParameter("@UserID", objBALSecUser.UserID);

                objSqlParameter[4] = new SqlParameter("@Password", objBALSecUser.Password);
                #endregion

               
               dt = SqlHelper.ExecuteDataset(SqlHelper.SqlCon, CommandType.StoredProcedure, spName, objSqlParameter).Tables[0];
               
            }
            catch (Exception ex)
            {
                DataRow dr = dt.NewRow();
                dt.Rows.Add(dr);
                dt.Rows[0][0] = 0;
            }
            return dt;
        }
コード例 #2
0
ファイル: BALSecUser.cs プロジェクト: Hadisaeed/FYP
 public DataTable SecUser(BALSecUser objBALSecUser)
 {
     DataTable dt = new DataTable();
     try
     {
         dt = objDALSecUser.SecUser(objBALSecUser);
     }
     catch (Exception ex)
     { }
     return dt;
 }
コード例 #3
0
ファイル: AdminLogin.cs プロジェクト: Hadisaeed/FYP
 public void Addredcord()
 {
     if (!Validation()) return;
     BALSecUser oBALSecUser = new BALSecUser();
     oBALSecUser.CRUD = "Search";
     oBALSecUser.UserID = txt_UserName.Text;
     oBALSecUser.Password = txt_Password.Text;
     DataTable dtSearch = new DataTable();
     dtSearch = oBALSecUser.SecUser(oBALSecUser);
     if (dtSearch != null && dtSearch.Rows.Count > 0)
     {
         //long _barCode = RandomNumber6D();
         //MessageBox.Show(_barCode.ToString());
         this.Hide();
         form_AdminSession AdminHome = new form_AdminSession();
         AdminHome.ShowDialog();
         this.Close();
     }
     else
     {
         MessageBox.Show("Id Or Password Not Correct");
     }
 }