示例#1
0
        public static int AddSupplier(SupplierDTO supplierDto)
        {
            string query = "INSERT INTO supplier (name, tel_mobile, email, is_active, created_by) VALUES " +
                           "( " + "'" + supplierDto.Name + "','" + supplierDto.Mobile + "','" + supplierDto.Email + "'," + supplierDto.IsActive + "," + supplierDto.CreatedBy + ")";

            try
            {
                DataTable supplierTable = DatabaseConnection.ConnectWithServer(query);
                if (supplierTable == null)
                {
                    return(-1);
                }

                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
示例#2
0
        public static int UpdateSupplier(SupplierDTO supplierDto)
        {
            string query = "UPDATE supplier SET name = '" + supplierDto.Name + "', tel_mobile = '" + supplierDto.Mobile +
                           "', email = '" + supplierDto.Email + "', is_active = " + supplierDto.IsActive +
                           ", updated_by = " + supplierDto.UpdatedBy + ", updated_at = '" + DateTime.Now + "' WHERE id = " + supplierDto.Id;

            try
            {
                DataTable supplierTable = DatabaseConnection.ConnectWithServer(query);
                if (supplierTable == null)
                {
                    return(-1);
                }

                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }