Ejemplo n.º 1
0
        public OutsiderLeasesInfo GetOutsiderLeasesInfo(string COLPhone, string CSEngine)
        {
            SQLConn sQLConn = new SQLConn();

            string query = @"select * from OutsiderLeasesInfo where 
                                SEngineNo = @CSEngineNo and OLPhone = @COLPhone";

            SqlCommand sqlCommand = new SqlCommand(query, sQLConn.GetConnToLocalDb());

            SqlParameter sqlParameter = new SqlParameter
            {
                ParameterName = "CSEngineNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = CSEngine
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "COLPhone",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = COLPhone
            };

            sqlCommand.Parameters.Add(sqlParameter);

            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            if (sqlDataReader.Read())
            {
                OutsiderLeasesInfo outsiderLeasesInfo = new OutsiderLeasesInfo
                {
                    OLCnic        = sqlDataReader[0].ToString(),
                    OLName        = sqlDataReader[1].ToString(),
                    OLPhone       = sqlDataReader[2].ToString(),
                    OLAddress     = sqlDataReader[3].ToString(),
                    SEngineNo     = sqlDataReader[4].ToString(),
                    OLAmount      = Int32.Parse(sqlDataReader[5].ToString()),
                    OLDuration    = Int32.Parse(sqlDataReader[6].ToString()),
                    OLAdvance     = Int32.Parse(sqlDataReader[7].ToString()),
                    OLInstallment = Int32.Parse(sqlDataReader[8].ToString()),
                    OLDate        = DateTime.Parse(sqlDataReader[9].ToString()),
                };
                return(outsiderLeasesInfo);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public void InsertOutsiderLeasesInfo(OutsiderLeasesInfo outsiderLeasesInfo)
        {
            SQLConn sQLConn = new SQLConn();

            string query = @"insert into OutsiderLeasesInfo (OLCnic , OLName , OLPhone , OLAddress,
                            SEngineNo , OLAmount , OLDuration , OLAdvance , OLInstallment , OLDate) 
                            values(@OLCnic , @OLName , @OLPhone , @OLAddress , 
                           @SEngineNo , @OLAmount , @OLDuration , @OLAdvance , @OLInstallment , @OLDate)";

            SqlCommand sqlCommand = new SqlCommand(query, sQLConn.GetConnToLocalDb());

            SqlParameter sqlParameter = new SqlParameter
            {
                ParameterName = "OLCnic",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLCnic
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLName",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLName
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLPhone",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLPhone
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLAddress",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLAddress
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SEngineNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.SEngineNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLAmount",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLAmount
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLDuration",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLDuration
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLAdvance",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLAdvance
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLInstallment",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLInstallment
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLDate",
                SqlDbType     = System.Data.SqlDbType.Date,
                Value         = outsiderLeasesInfo.OLDate
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlCommand.ExecuteNonQuery();
        }
Ejemplo n.º 3
0
        public void UpdateOutsiderLeasesInfo(OutsiderLeasesInfo outsiderLeasesInfo, string COLPhone, string CSEngine)
        {
            SQLConn sQLConn = new SQLConn();
            string  query   = @"Update OutsiderLeasesInfo set
                           OLCnic = @OLCnic, OLName = @OLName, OLPhone = @OLPhone
                           , OLAdvance = @OLAdvance, OLAmount = @OLAmount , OLDuration = @OLDuration,
                           OLInstallment = @OLInstallment , OLDate = @OLDate
                             where OLPhone = @COLPhone and SEngineNo = @CSEngineNo";

            SqlCommand sqlCommand = new SqlCommand(query, sQLConn.GetConnToLocalDb());

            SqlParameter sqlParameter = new SqlParameter
            {
                ParameterName = "OLCnic",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLCnic
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLName",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLName
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLInstallment",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLInstallment
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLPhone",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLPhone
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLAddress",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.OLAddress
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLAmount",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLAmount
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLDuration",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLDuration
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLAdvance",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = outsiderLeasesInfo.OLAdvance
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "SEngineNo",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = outsiderLeasesInfo.SEngineNo
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "OLDate",
                SqlDbType     = System.Data.SqlDbType.Date,
                Value         = outsiderLeasesInfo.OLDate
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "COLPhone",
                SqlDbType     = System.Data.SqlDbType.NVarChar,
                Value         = COLPhone
            };

            sqlCommand.Parameters.Add(sqlParameter);

            sqlParameter = new SqlParameter
            {
                ParameterName = "CSEngineNo",
                SqlDbType     = System.Data.SqlDbType.Int,
                Value         = CSEngine
            };

            sqlCommand.Parameters.Add(sqlParameter);


            sqlCommand.ExecuteNonQuery();
        }