/*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(SeniorEmployeeRep se)
        {
            string query = "SELECT * from SeniorEmployee WHERE Id= '" + se.SeniorEmployeeid + "' AND Password= '******'";
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

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

            if (sdr.Read())
            {
                se.SeniorEmployeename    = sdr["Name"].ToString();
                se.Gender                = sdr["Gender"].ToString();
                se.SeniorEmployeeaddress = sdr["Address"].ToString();
                se.Email    = sdr["Email"].ToString();
                se.Status   = sdr["Status"].ToString();
                se.Contacts = sdr["Contact"].ToString();
                dcc.CloseConnection();
                return(true);
            }
            else
            {
                dcc.CloseConnection();
                return(false);
            }
        }
Пример #2
0
        public List <ClientRep> SearchClient(string text)
        {
            string                  query = "SELECT * from Client WHERE Name LIKE '%" + text + "%'"; //OR AccountHolderName LIKE '%" + text + "%'";
            List <ClientRep>        aList = new List <ClientRep>();
            DatabaseConnectionClass dcc   = new DatabaseConnectionClass();

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

            while (sdr.Read())
            {
                ClientRep a = new ClientRep();
                //a.AccountId = sdr["AccountId"].ToString();
                //a.AccountHolderName = sdr["AccountHolderName"].ToString();
                //a.Balance = Convert.ToDouble(sdr["Balance"]);

                a.Id       = sdr["Id"].ToString();
                a.Name     = sdr["Name"].ToString();
                a.Address  = sdr["Address"].ToString();
                a.Email    = sdr["Email"].ToString();
                a.Contacts = sdr["Contact"].ToString();


                aList.Add(a);
            }
            return(aList);
        }
 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);
     }
 }
 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);
     }
 }
 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);
     }
 }
 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);
     }
 }
Пример #10
0
        /*public bool Update(SeniorEmployeeRep se)
         * {
         *  try
         *  {
         *      string query = "UPDATE SeniorEmployee SET Name = '" + se.SeniorEmployeename + "', Address = " + se.SeniorEmployeeaddress + ", Contacts = '" + se.Contacts + "' WHERE Id= '" + se.SeniorEmployeeid + "'";
         *      DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         *      dcc.ConnectWithDB();
         *      int x = dcc.ExecuteSQL(query);
         *      dcc.CloseConnection();
         *      return true;
         *  }
         *  catch (Exception ex)
         *  {
         *      return false;
         *  }
         * }
         *
         * 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;
         *  }
         * }*/


        public List <VehicleRep> GetAllVehicle()
        {
            string                  query  = "SELECT * from Vehicle";
            List <VehicleRep>       crList = new List <VehicleRep>();
            DatabaseConnectionClass dcc    = new DatabaseConnectionClass();

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

            while (sdr.Read())
            {
                VehicleRep cr = new VehicleRep();
                //a.AccountId = sdr["AccountId"].ToString();
                //a.AccountHolderName = sdr["AccountHolderName"].ToString();
                //a.Balance = Convert.ToDouble(sdr["Balance"]);

                //cr.SalesID = sdr["ID"].ToString();
                //cr.CustName = sdr["Name"].ToString();
                ////cr.Gender =
                ////se.SeniorEmployeename = sdr["Name"].ToString();
                ////cr.CustGender = sdr["Gender"].ToString();
                //cr.CustAddress = sdr["Address"].ToString();
                //cr.CustMail = sdr["Email"].ToString();
                ////cr.Status = sdr["Status"].ToString();
                //cr.CustContacts = sdr["Contact"].ToString();
                //cr.Payment = sdr["Payment"].ToString();
                //cr.VecModel = sdr["VehicleModel"].ToString();
                //cr.VecNetCost = sdr["NetCost"].ToString();
                //cr.Date = sdr["PurchaseDate"].ToString();
                //cr.SalesInvoice = sdr["SalesInvoice"].ToString();

                cr.CarID     = sdr["Id"].ToString();
                cr.Category  = sdr["Category"].ToString();
                cr.ModelName = sdr["ModelName"].ToString();
                cr.Date      = sdr["Added Date"].ToString();
                cr.Engine    = sdr["EngineType"].ToString();
                cr.Color     = sdr["Color"].ToString();
                cr.Cost      = sdr["Cost"].ToString();
                cr.Seat      = sdr["Seat"].ToString();

                crList.Add(cr);
            }
            return(crList);
        }
Пример #11
0
        public List <ClientRep> GetAllClient()
        {
            string                  query  = "SELECT * from Client";
            List <ClientRep>        crList = new List <ClientRep>();
            DatabaseConnectionClass dcc    = new DatabaseConnectionClass();

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

            while (sdr.Read())
            {
                ClientRep cr = new ClientRep();

                ////a.AccountId = sdr["AccountId"].ToString();
                ////a.AccountHolderName = sdr["AccountHolderName"].ToString();
                ////a.Balance = Convert.ToDouble(sdr["Balance"]);

                //cr.SalesID = sdr["ID"].ToString();
                //cr.CustName = sdr["Name"].ToString();
                ////cr.Gender =
                ////se.SeniorEmployeename = sdr["Name"].ToString();
                ////cr.CustGender = sdr["Gender"].ToString();
                //cr.CustAddress = sdr["Address"].ToString();
                //cr.CustMail = sdr["Email"].ToString();
                ////cr.Status = sdr["Status"].ToString();
                //cr.CustContacts = sdr["Contact"].ToString();
                //cr.Payment = sdr["Payment"].ToString();
                //cr.VecModel = sdr["VehicleModel"].ToString();
                //cr.VecNetCost = sdr["NetCost"].ToString();
                //cr.Date = sdr["PurchaseDate"].ToString();

                cr.Id         = sdr["Id"].ToString();
                cr.Name       = sdr["Name"].ToString();
                cr.Address    = sdr["Address"].ToString();
                cr.Email      = sdr["Email"].ToString();
                cr.Contacts   = sdr["Contact"].ToString();
                cr.Occupation = sdr["Occupation"].ToString();

                crList.Add(cr);
            }
            return(crList);
        }