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);
     }
 }
 public bool Insert(SeniorEmployeeRep se)
 {
     try
     {
         string query = "INSERT into SeniorEmployee VALUES ('" + se.SeniorEmployeeid + "', '" + se.SeniorEmployeename + "', '" + se.Gender + "', '" + se.SeniorEmployeeaddress + "', '" + se.Email + "', '" + se.Contacts + "', '" + se.Status + "','" + se.Password + "','" + se.Salary + "')";
         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(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);
     }
 }
Пример #5
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);
        }
Пример #6
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);
        }