コード例 #1
0
        /*public bool Update(EmployeeRep emp)
         * {
         *  try
         *  {
         *      string query = "UPDATE Employees SET EmployeeName = '" + emp.EmployeeName + "', Salary = " + emp.Salary + ", Designation = '" + emp.Designation + "' WHERE EmployeeId= '" + emp.EmployeeId + "'";
         *      DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         *      dcc.ConnectWithDB();
         *      int x = dcc.ExecuteSQL(query);
         *      dcc.CloseConnection();
         *      return true;
         *  }
         *  catch (Exception ex)
         *  {
         *      return false;
         *  }
         * }
         * public bool Delete(string employeeId)
         * {
         *  try
         *  {
         *      string query = "DELETE from Employees WHERE EmployeeId = '" + employeeId + "'";
         *      DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         *      dcc.ConnectWithDB();
         *      int x = dcc.ExecuteSQL(query);
         *      dcc.CloseConnection();
         *      return true;
         *  }
         *  catch (Exception ex)
         *  {
         *      return false;
         *  }
         * }*/

        /*public Employee GetEmployee(string employeeId)
         * {
         *  string query = "SELECT * from Employees WHERE EmployeeId= '" + employeeId + "'";
         *  Employee emp = null;
         *  DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         *  dcc.ConnectWithDB();
         *  SqlDataReader sdr = dcc.GetData(query);
         *  if (sdr.Read())
         *  {
         *      emp = new Employee();
         *      emp.EmployeeId = sdr["EmployeeId"].ToString();
         *      emp.Password = sdr["Password"].ToString();
         *      emp.EmployeeName = sdr["EmployeeName"].ToString();
         *      emp.Salary = Convert.ToDouble(sdr["Salary"]);
         *      emp.Designation = sdr["Designation"].ToString();
         *  }
         *  dcc.CloseConnection();
         *  return emp;
         * }
         *
         * public List<Employee> GetAllEmployees()
         * {
         *  string query = "SELECT * from Employees";
         *  List<Employee> empList = new List<Employee>();
         *  DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         *  dcc.ConnectWithDB();
         *  SqlDataReader sdr = dcc.GetData(query);
         *  while (sdr.Read())
         *  {
         *      Employee emp = new Employee();
         *      emp.EmployeeId = sdr["EmployeeId"].ToString();
         *      emp.Password = sdr["Password"].ToString();
         *      emp.EmployeeName = sdr["EmployeeName"].ToString();
         *      emp.Salary = Convert.ToDouble(sdr["Salary"]);
         *      emp.Designation = sdr["Designation"].ToString();
         *  }
         *  dcc.CloseConnection();
         *  return empList;
         * }*/

        public bool UserLoginVerification(EmployeeRep emp)
        {
            string query = "SELECT * from Employee WHERE Id= '" + emp.Employeeid + "' AND Password= '******'";
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                emp.Employeename = sdr["Name"].ToString();
                emp.Gender       = sdr["Gender"].ToString();
                emp.Address      = sdr["Address"].ToString();
                emp.Email        = sdr["Email"].ToString();
                emp.Status       = sdr["Status"].ToString();
                emp.Contacts     = sdr["Contact"].ToString();

                dcc.CloseConnection();
                return(true);
            }
            else
            {
                dcc.CloseConnection();
                return(false);
            }
        }
コード例 #2
0
        public bool UserLoginVerification(LoginRep l)
        {
            string query = "SELECT * from LoginBase WHERE ID= '" + l.ID + "' AND Password= '******'";
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                l.Name   = sdr["Name"].ToString();
                l.Status = sdr["Status"].ToString();
                Console.WriteLine("heyy--" + l.Status);

                //emp.Salary = Convert.ToDouble(sdr["Salary"]);
                //emp.Designation = sdr["Designation"].ToString();
                dcc.CloseConnection();
                return(true);
            }
            else
            {
                dcc.CloseConnection();
                return(false);
            }
        }
コード例 #3
0
 public bool Insert(SalesRep sr)
 {
     try
     {
         string query = "INSERT into Sales VALUES ('" + sr.SalesID + "', '" + sr.CustName + "', '" + sr.CustAddress + "', '" + sr.CustContacts + "', '" + sr.CustMail + "', '" + sr.VecModel + "', '" + sr.VecNetCost + "','" + sr.Payment + "','" + sr.Date + "','" + sr.SalesInvoice + "')";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #4
0
 public bool Insert(VehicleRep vr)
 {
     try
     {
         string query = "INSERT into Vehicle VALUES ('" + vr.CarID + "', '" + vr.Category + "', '" + vr.ModelName + "','" + vr.Date + "','" + vr.Engine + "','" + vr.Color + "','" + vr.Cost + "','" + vr.Seat + "' )";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #5
0
 public bool Insert(EmployeeRep emp)
 {
     try
     {
         string query = "INSERT into Employee VALUES ('" + emp.Employeeid + "', '" + emp.Employeename + "', '" + emp.Gender + "', '" + emp.Address + "', '" + emp.Email + "', '" + emp.Contacts + "', '" + emp.Status + "','" + emp.Password + "','" + emp.Salary + "')";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #6
0
 public bool Insert(ManufacturerRep mr)
 {
     try
     {
         string query = "INSERT into Manufacturer VALUES ('" + mr.Id + "', '" + mr.Name + "', '" + mr.Address + "', '" + mr.Email + "', '" + mr.Contacts + "', '" + mr.Status + "')";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #7
0
 public bool Delete(string seniorEmployeeID)
 {
     try
     {
         string query = "DELETE from SeniorEmployee WHERE Id = '" + seniorEmployeeID + "'";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #8
0
 public bool Update(SeniorEmployeeRep se)
 {
     try
     {
         string query = "UPDATE SeniorEmployee SET Name = '" + se.SeniorEmployeename + "', Gender = " + se.Gender + ", Address = '" + se.SeniorEmployeeaddress + "', Email = '" + se.Email + "', Contacts = '" + se.Contacts + "', Status = '" + se.Status + "', Password = '******', Salary = '" + se.Salary + "' WHERE Id= '" + se.SeniorEmployeeid + "'";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #9
0
 public bool Insert(ClientRep cr)
 {
     try
     {
         string query = "INSERT into Client VALUES ('" + cr.Id + "', '" + cr.Name + "', '" + cr.Gender + "', '" + cr.Address + "', '" + cr.Email + "', '" + cr.Contacts + "', '" + cr.Password + "','" + cr.Occupation + "','" + cr.AddedBy + "')";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }